更新apt源清华镜像地址https://mirrors.tuna.tsinghua...阿里云镜像地址https://developer.aliyun.com/...//查看ubuntu版本猫/etc/issuemv/etc/apt/sources.list/etc/apt/sources.list.bakvim/etc/apt/sources.list//输入以上网址选择对应版本复制内容apt-getupdateapt-getupgradeLNMPbuildlog记录php安装sudoaptinstall-ysoftware-properties-commonsudoadd-apt-repository-yppa:ondrej/phpsudoaptupdate#installphpsudoaptinstall-yphp7.4-fpmphp7.4-redisphp7.4-commonphp7.4-bcmathphp7.4-curlphp7.4-gdphp7.4-mbstringphp7.4-mysqlphp7.4-xmlphp7.4-zipphp7.4-swoole#修改PHP池sudosed-i's/listen=.*/listen=127.0.0.1:9000/'/etc/php/7.4/fpm/pool.d/www.conf#restartphp-fpmsudosystemctlrestartphp7.4-fpm#composersudocurl-sShttps://getcomposer.org/installer|phpsudomvcomposer.phar/usr/local/bin/composerssudocomposerconfig-grepo.packagistcomposerhttps://mirrors.aliyun.com/composer/#cleanuninstallsudoapt-getautoremovephp7*sudofind/etc-name"*php*"|xargsrm-rfsu做aptpurge`dpkg-l|grepphp|awk'{print$2}'|tr"\n"""`start:立即启动后续单元stop:立即关闭后续单元。restart:立即关闭并启动后续单元,即先停止再启动。reload:在不关闭单元的情况下重新加载配置文件使设置生效。enable:设置下次开机时启动下一个单元。disable:设置下次开机时不启动后续单元。status:下面单元的当前状态,会列出是否正在执行,开机时是否启动等信息。is-active:当前是否正在运行。is-enable:启动时是否默认启用此单元。kill:不要被kill这个名字吓到,它实际上是向运行该单元的进程发送信号。show:列出单元的配置。掩码:注销单元,注销后无法启动该单元。unmask:取消单元的unmask。PHPCLIsudosed-i's/display_errors=.*/display_errors=On/'/etc/php/7.4/cli/php.inisudosed-i's/error_reporting=.*/error_reporting=E_ALL/'/etc/php/7.4/cli/php.inisudosed-i's/memory_limit=.*/memory_limit=512M/'/etc/php/7.4/cli/php.inisudosed-i's/;date.timezone.*/date.timezone=UTC/'/etc/php/7.4/cli/php.iniPHPFPMsudosed-i's/error_reporting=.*/error_reporting=E_ALL&~E_NOTICE&~E_STRICT&~E_DEPRECATED/'/etc/php/7.4/fpm/php.inisudosed-i's/memory_limit=.*/memory_limit=512M/'/etc/php/7.4/fpm/php.inisudosed-i's/upload_max_filesize=.*/upload_max_filesize=50M/'/etc/php/7.4/fpm/php.inisudosed-i's/post_max_size=.*/post_max_size=50M/'/etc/php/7.4/fpm/php.inisudosed-i's/;date.timezone.*/date.timezone=UTC/'/etc/php/7.4/fpm/php.iniPHPPoolssudosed-i's/user=www-data/user=www/'/etc/php/7.4/fpm/pool.d/www.confsudosed-i's/group=www-data/group=www/'/etc/php/7.4/fpm/pool.d/www.confsudosed-i's/listen=.*/listen=127.0.0.1:9000/'/etc/php/7.4/fpm/pool.d/www.confsudosed-i's/listen.owner.*/listen.owner=www/'/etc/php/7.4/fpm/pool.d/www.confsudosed-i's/listen.group.*/listen.group=www/'/etc/php/7.4/fpm/pool.d/www.confsudosed-i's/;listen.mode.*/listen.mode=0666/'/etc/php/7.4/fpm/pool.d/www.confnginx安装aptremovenginxnginx-commonnginx-fullnginx-coresudoaptinstall-ycurlgnupg2ca-certificateslsb-releaseecho"debhttp://nginx.org/packages/ubuntu`lsb_release-cs`nginx"\|sudotee/etc/apt/sources.list.d/nginx.listwgethttp://nginx.org/keys/nginx_signing.keysudoapt-keyaddnginx_signing.keyrm-rfnginx_signing.keyaptinstallnginxservicenginxstopservicenginxstartservicenginxrestartservicenginxstatusnginxnginx-squitnginx-sstopnginx-t-c/etc/nginx/nginx.confnginx-tnginx-sreloadnginx-sreopennginx与php配置文件方式1:推荐使用location~\.php${fastcgi_split_path_info^(.+\.php)(/.+)$;fastcgi_passunix:/var/run/php/php7.2-fpm.sock;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$DOCUMENT_ROOT$fastcgi_script_name;包括fastcgi_params;}方法二:需要修改/etc/php/7.2/fpm/pool.d/www.conflocation~.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$DOCUMENT_ROOT$fastcgi_script_name;包括fastcgi_params;}//需要修改/etc/php/7.2/fpm/pool.d/www.conf;listen=/run/php/php7.2-fpm.socklisten=127.0.0.1:9000openrestyinstallapt-getupdate#导入我们的GPG密钥:wget-qO-https://openresty.org/package/pubkey.gpg|sudoapt-keyadd-#installadd-apt-repositorycommand#(以后可以删除这个包和对应的关联包)sudoapt-get-yinstallsoftware-properties-common#添加我们官方官方的APT仓库:sudoadd-apt-repository-y"debhttp://openresty.org/package/ubuntu$(lsb_release-sc)main"#更新APT索引:sudoapt-getupdate#然后就可以这样安装包了,比如openresty:sudoapt-getinstallopenrestyexportPATH=$PATH:/usr/local/openresty/nginx/sbinmysqlinstallaptinstall-ymysql-servermysql-clientservicemysqlstartservicemysqlstatusservicemysqlstopservicemysqlrestart//commentmy.cnf//#bind-address=127.0.0.1mysql-uroot-p//给rootremote登录权限mysql>GRANTALLPRIVILEGESON*.*TO'root'@'%'IDENTIFIEDBY'123456';mysql>selectHost,User,authentication_stringfrommysql.user;mysql>createuser"zhiqiang"@"localhost"identified通过"123456";mysql>updatemysql.usersetauthentication_string=password("123456")whereUser="root";mysql>alteruser'zhiqiang'@'localhost'identifiedby"123456";mysql>setpasswordfor'zhiqiang'@'localhost'='123456';mysql>updateusersetplugin="mysql_native_password";mysql>flushprivileges;#先创建数据库(zqw)createdatabasezqw;#授权zhiqw用户拥有所有权限zqw数据库,但只能本地访问grantallprivilegesonzqw.*to'zqw'@localhostidentifiedby'123456';#用户可以远程访问zqw数据库grantallprivilegesonzqw.*to'zqw'@'%'identifiedby'123456';#刷新系统权限表flushprivileges;#卸载sudorm/var/lib/mysql/-Rsudorm/etc/mysql/-Rsudoapt-getautoremovemysql*--purgebuildGitLabnoteshttps://about.gitlab.com/install/apt-getinstallcurlopenssh-serverca-certificatespostfixservicesshd启动服务postfix启动sudocurl-sShttps://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh|sudobashaptinstall-ygitlab-ce//配置访问路径vi/etc/gitlab/gitlab.rb>external_url'http://127.0.0.1'//更新配置gitlab-ctlreconfigure启动所有Gitlab组件gitlab-ctlstart//restartgitlabgitlab-ctlrestart//查看状态gitlab-ctlstatusRabbitMQ环境搭建aptinstall-yrabbitmq-server启动rabbit服务:servicerabbitmq-serverstart停止rabbit服务:servicerabbitmq-serverstop后台启动:rabbitmq-server-detachedRunningstatus:rabbitmqctlstatus查看所有用户:rabbitmqctllist_users添加用户:rabbitmqctladd_userusername密码删除用户:rabbitmqctldelete_userusername修改密码:rabbitmqctlchange_passwordusernamenewpasswordsetsuperpermissionrabbitmqctlset_user_tagsusernameadministratorrabbitmqctlset_permissions-p/username".\*"".\*"".\*"打开rabbitweb控制台进入rabbit安装目录:cd/usr/lib/rabbitmq查看安装的插件:rabbitmq-pluginslist打开网页版控制台:rabbitmq-pluginsenablerabbitmq_management重启rabbitmq服务输入网页访问地址:http://localhost:15672使用默认账号:guest/guestloginspugbuildaptinstall-ysupervisorredisgitpython3-devpython3-venvlibsasl2-devpython-devlibldap2-devlibssl-devaptinstall-ylibmariadbclient-devmkdir/datacd/datagitclonehttps://github.com/openspug/spugcdspug&&gitcheckout-bv2.3.16//后端部署cd/data/spug/spug_apipython3-mvenvvenvsourcevenv/bin/activatepipinstall-Upip-ihttps://pypi.tuna.tsinghua.edu.cn/simple/pipinstall-rrequirements.txt-ihttps://pypi.tuna.tsinghua.edu.cn/simple/pipinstallgunicornmysqlclient-ihttps://pypi.tuna.tsinghua.edu.cn/simple/python3manage.pyupdateddbpythonmanage.pyuseradd-uadmin-pspug.dev-s-nadministrator//前端部署https://github.com/openspug/spug/releases/download/v2.3.16/web_v2.3.16.tar.gzrm-rf/data/spug/spug_webmkdir-p/data/spug/spug_webtarzxfweb_v2.3.16.tar.gz-C/data/spug/spug_webspug-nginx配置参考:https://spug.dev/docs/deploy-product///daemoncp/data/spug/spug_api/tools/supervisor-spug.ini/etc/supervisor/conf.d/supervisor-spug.confservicenginxrestartservicesupervisor重启服务redis重启
