Toggle navigation
首页
[
Markdown
]
准备工作 ``` #关闭selinux: $ vi /etc/selinux/config #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 :wq 保存,退出 $ reboot #重启系统 ``` ``` vi /etc/security/limits.conf * soft nofile 65535 * hard nofile 65535 vi /etc/profile ulimit -SHn 65535 ``` ``` #生成一个空的www用户 $ groupadd -r www $ useradd www -g www -M -s /sbin/nologin ``` ``` #生成一个空的mysql用户 $ groupadd mysql $ useradd mysql -g mysql -M -s /sbin/nologin ``` ```ssh # centos $ yum install epel-release //扩展包更新包 $ yum update //更新yum源 $ yum -y install gcc gcc-c++ autoconf automake libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel freetype-devel libmcrypt libmcrypt-devel mcrypt mhash zlib-devel pcre-devel sqlite-devel oniguruma-devel libwebp-devel ``` ``` yum remove libzip -y wget https://libzip.org/download/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install ln /usr/local/lib/libzip/include/zipconf.h /usr/local/include/ ``` ``` # php编译安装 # https://www.php.net/distributions/php-7.4.33.tar.gz ./configure --prefix=/data/php --with-config-file-path=/data/php/etc --with-config-file-scan-dir=/data/php/etc/php.d --with-libdir=lib64 --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-opcache --enable-pcntl --enable-mbstring --enable-soap --enable-zip --enable-calendar --enable-bcmath --enable-exif --enable-ftp --enable-intl --with-iconv --enable-shmop --enable-sysvsem --enable-xml --enable-inline-optimization --enable-shared --enable-mbregex --with-openssl --with-zlib-dir --with-curl --enable-sockets --with-gd --with-jpeg-dir --with-webp-dir --with-gettext --with-freetype-dir --with-mhash --with-ldap --with-xmlrpc --disable-debug --disable-rpath $ make $ make install ``` ```ssh #复制配置文件 $ cp php.ini-production /data/php/etc/php.ini #复制fpm配置文件 $ cp /data/php/etc/php-fpm.conf.default /data/php/etc/php-fpm.conf #生成配置文件目录 自动挂载配置 $ mkdir /data/php/etc/php.d # 启动服务 $ cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm $ chmod u+x /etc/init.d/php-fpm $ service php-fpm start #随机启动 $ chkconfig php-fpm on ``` ```ssh $ jobs $ fg %n $ kill -9 pid $ kill -HUP pid ``` ```ssh $ vi /etc/profile #把php安装路径放入系统路径中 PATH=$PATH:/data/php/bin $ source /etc/profile ``` ``` php-fpm 关闭: pkill php-fpm #强制关闭 /data/php/sbin/php-fpm #启动 kill -INT `cat /data/php/var/run/php-fpm.pid` php-fpm 重启: kill -USR2 `cat /data/php/var/run/php-fpm.pid` 查看php-fpm进程数: ps aux | grep -c php-fpm ``` ```ssh #composer安装 $ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer ``` ```ssh #swoole插件安装 # https://pecl.php.net/get/swoole-4.8.13.tgz php7+ $ phpize $ ./configure $ make $ make install extension=swoole.so ``` ``` # mysql编译安装 # mysql5.7 https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.32.tar.gz #建立mysql安装和数据路径 $ mkdir -p /data/mysql/data $ yum -y install make gcc-c++ cmake ncurses-devel bison bison-devel perl perl-devel cmake -DCMAKE_INSTALL_PREFIX=/data/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysql/data -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 -DWITH_BOOST=./boost $ make $ make install $ vi /etc/profile #把mysql安装路径放入系统路径 PATH=$PATH:/data/mysql/bin:/data/mysql/lib $ source /etc/profile //使刚才的修改生效 #启动服务 $ cp support-files/mysql.server /etc/init.d/mysqld $ chmod u+x /etc/init.d/mysqld #随机启动 $ chkconfig mysqld on #让mysql安装路径和数据路径的所有者为mysql $ chown -R mysql:mysql /data/mysql ``` ``` #初始化数据库 $ mysqld --initialize #启动mysql服务 $ service mysqld start ``` ``` #免密码登入 mysqld_safe --skip-grant-tables --skip-networking mysql -u root ``` ``` #有密码登入 $ mysql -u root -p #更换root密码 5.7 $ mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('12345678'); $ mysql> exit $ mysql -u root -p #创建远程账户 5.7 $ mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678' WITH GRANT OPTION; #更换root密码 8.0 # ALTER USER 'root'@'%' IDENTIFIED BY '12345678'; # 创建用户 mysql> create user 'root'@'%' identified by '12345678'; # 给用户授权 mysql> grant all privileges on *.* to 'root'@'%'; # 刷新 mysql> flush privileges; mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '12345678'; mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678'; ``` ``` # nginx编译安装 # http://nginx.org/download/nginx-1.16.0.tar.gz ./configure --prefix=/data/nginx --sbin-path=/data/nginx/nginx --conf-path=/data/nginx/etc/nginx.conf --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --pid-path=/data/nginx/nginx.pid --lock-path=/data/nginx/nginx.lock --user=www --group=www --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --http-client-body-temp-path=/data/nginx/temp/client/ --http-proxy-temp-path=/data/nginx/temp/proxy/ --http-fastcgi-temp-path=/data/nginx/temp/fcgi/ --http-uwsgi-temp-path=/data/nginx/temp/uwsgi --http-scgi-temp-path=/data/nginx/temp/scgi -–with-stream mkdir -p /data/logs/nginx/ mkdir -p /data/nginx/temp/client/ mkdir -p /data/nginx/temp/proxy/ mkdir -p /data/nginx/temp/fcgi/ mkdir -p /data/nginx/temp/uwsgi mkdir -p /data/nginx/temp/scgi $ make $ make install ``` ``` # Tengine编译安装 # http://tengine.taobao.org/download/tengine-2.3.1.tar.gz # https://github.com/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2 # https://github.com/jemalloc/jemalloc/archive/5.2.0.tar.gz ./configure --prefix=/data/nginx --sbin-path=/data/nginx/nginx --conf-path=/data/nginx/etc/nginx.conf --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --pid-path=/data/nginx/nginx.pid --lock-path=/data/nginx/nginx.lock --user=www --group=www --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --http-client-body-temp-path=/data/nginx/temp/client/ --http-proxy-temp-path=/data/nginx/temp/proxy/ --http-fastcgi-temp-path=/data/nginx/temp/fcgi/ --http-uwsgi-temp-path=/data/nginx/temp/uwsgi --http-scgi-temp-path=/data/nginx/temp/scgi --dso-path=/data/nginx/dso/path --dso-tool-path=/data/nginx/dso/tool --with-jemalloc=/data/soft/jemalloc mkdir -p /data/logs/nginx/ mkdir -p /data/nginx/temp/client/ mkdir -p /data/nginx/temp/proxy/ mkdir -p /data/nginx/temp/fcgi/ mkdir -p /data/nginx/temp/uwsgi mkdir -p /data/nginx/temp/scgi mkdir -p /data/nginx/dso/path mkdir -p /data/nginx/dso/tool $ make $ make install ``` ``` [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/data/nginx/nginx ExecReload=/data/nginx/nginx -s reload ExecStop=/data/nginx/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target ```
[
Html
]