编译安装nginx
cd /opt/ tar zxvf nginx-1.22.0.tar.gz -C /opt/ cd nginx-1.22.0/ ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module make -j16&& make install bash setup-local-yum-repo.sh yum -y install gcc pcre-devel openssl-devel zlib-devel openssl openssl-devel make -j16&& make install make -j16 && make install ls rm setup-local-yum-repo.sh cd nginx-1.22.0/ ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module make -j16 && make install ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ tee /lib/systemd/system/nginx.service <<eof [Unit] Description=nginx After=network.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/bin/kill -1 $MAINPID ExecStop=/bin/kill -3 $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target eof chmod 777 /lib/systemd/system/nginx.service sudo useradd -r -d /var/www -s /sbin/nologin nginx systemctl daemon-reload systemctl start nginx
安装数据库
yum -y install ncurses ncurses-devel bison cmake
yum -y install gcc gcc-c++ cmake bison bison-devel zlib-devel libcurl-devellibarchive-devel boost-devel ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel
useradd -M -s /sbin/nologin mysql
tar zxvf mysql-boost-5.7.20.tar.gz
cd /opt/mysql-5.7.20/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DSYSTEMD_PID_DIR=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_BOOST=boost -DWITH_SYSTEMD=1
make -j12&& make install
vim /etc/my.cnf[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
chown -R mysql:mysql /usr/local/mysql/
chown mysql:mysql /etc/my.cnf
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
source /etc/profile
cd /usr/local/mysql/bin/
./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl start mysqld.service
systemctl enable mysqld
mysqladmin -u root -p password "123456"
mysql -u root -p
安装php软件
68 yum -y install gd libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel
69 tar jxvf php-7.1.10.tar.bz2
70 cd php-7.1.10
71 ./configure --prefix=/usr/local/php --with-mysql-sock=/usr/local/mysql/mysql.sock --with-mysqli --with-zlib --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-openssl --enable-fpm --enable-mbstring --enable-xml --enable-session --enable-ftp --enable-pdo --enable-tokenizer --enable-zip
72 make -j16&& make install
73 ln -s /usr/local/php/bin/* /usr/local/bin/
74 ln -s /usr/local/php/sbin/* /usr/local/sbin/
75 cp /opt/php-7.1.10/php.ini-development /usr/local/php/lib/php.ini
76 vim /usr/local/php/lib/php.ini
77 php -m
78 cd /usr/local/php/etc/
79 cp php-fpm.conf.default php-fpm.conf
80 vim php-fpm.conf--1170行--修改
mysqli.default_socket = /usr/local/mysql/mysql.sock
--939行--取消注释,修改
date.timezone = Asia/Shanghai
81 cd /usr/local/php/etc/php-fpm.d/
82 cp www.conf.default www.conf
83 /usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
84 netstat -anpt | grep 9000
85 cd /opt/php-7.1.10/sapi/fpm
86 cp php-fpm.service /usr/lib/systemd/system/php-fpm.service
87 systemctl restart php-fpm.service
88 vim /usr/local/nginx/conf/nginx.conf
--17行--去掉";"注释
pid = run/php-fpm.pid
89 systemctl restart nginx.service
90 vim /usr/local/nginx/html/index.php
<?php
phpinfo();
?>
91 setenforce 0
92 systemctl stop firewalld.service
93 mysql -u root -p123456
94 vim /usr/local/nginx/html/index.php
<?php
$link=mysqli_connect('192.168.10.40','bbsuser','admin123');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
?>
95 cd /opt/
96 unzip Discuz_X3.4_SC_UTF8.zip
97 cd /opt/dir_SC_UTF8/
98 cp -r upload/ /usr/local/nginx/html/bbs/
99 cd /usr/local/nginx/html/bbs/
100 chown -R nginx ./config/
101 chown -R nginx ./data/
102 chown -R nginx ./uc_client/
103 chown -R nginx ./uc_server/
104 chmod -R 777 ./config/
105 chmod -R 777 ./data/
106 chmod -R 777 ./uc_client/
107 chmod -R 777 ./uc_server/