实验所需安装包
MysqL-5.5.22.tar.gz
cmake-2.8.6.tar.gz
Nginx-1.11.5.tar.gz
PHP-5.6.37.tar.gz
libmcrypt-2.5.8.tar.gz
mcrypt-2.6.8.tar.gz
mhash-0.9.9.9.tar.gz
ZendGuardLoader-PHP-5.3-linux-glibc23-x86_64.tar.gz
解压安装MysqL需要的安装包并安装依赖环境
[root@localhost ~]# tar zxf cmake-2.8.6.tar.gz -C /usr/src/
[root@localhost ~]# tar zxf MysqL-5.5.22.tar.gz -C /usr/src/
[root@localhost ~]# mount /dev/sr0 /media/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# yum -y install ncurses-devel
编译安装camke 和 MysqL
[root@localhost ~]# cd /usr/src/cmake-2.8.6/
[root@localhost cmake-2.8.6]# ./configure
[root@localhost cmake-2.8.6]# gmake
[root@localhost cmake-2.8.6]# gmake install
[root@localhost cmake-2.8.6]# cd ../MysqL-5.5.22/
[root@localhost MysqL-5.5.22]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/MysqL -DSYSconfdIR=/etc/ -DDEFAULT_CHARSET=utf8 -DDFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
[root@localhost MysqL-5.5.22]# make && make install
[root@localhost MysqL-5.5.22]# useradd -M -s /sbin/nologin MysqL
[root@localhost local]# chown -R MysqL:MysqL MysqL/
[root@localhost MysqL-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost MysqL-5.5.22]# /usr/local/MysqL/scripts/MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL --datadir=/usr/local/MysqL/data/
创建环境变量并启动加入系统服务
[root@localhost MysqL-5.5.22]# echo "PATH=$PATH:/usr/local/MysqL/bin" >> /etc/profile
[root@localhost MysqL-5.5.22]# cp support-files/MysqL.server /etc/rc.d/init.d/MysqLd
[root@localhost MysqL-5.5.22]# chmod +x /etc/init.d/MysqLd [root@localhost MysqL-5.5.22]# . /etc/profile
[root@localhost ~]# chkconfig --add MysqLd
[root@localhost ~]# systemctl start MysqLd
[root@localhost ~]# MysqLd
MysqLd MysqLd_safe MysqLdumpslow
MysqLd_multi MysqLdump
[root@localhost ~]# MysqLadmin -u root password "123456"
[root@localhost ~]# netstat -anpt | grep "MysqL"
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1717/MysqLd
[root@localhost ~]# tar zxf Nginx-1.11.5.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/Nginx-1.11.5/
[root@localhost Nginx-1.11.5]# yum -y install pcre-devel openssl-devel
[root@localhost Nginx-1.11.5]# ./configure --prefix=/usr/local/Nginx --user=Nginx --group=Nginx --with-http_stub_status_module --with-stream
[root@localhost Nginx-1.11.5]# make
[root@localhost Nginx-1.11.5]# make install
[root@localhost sbin]# ln -s /usr/local/Nginx/sbin/Nginx /usr/local/sbin/
[root@localhost sbin]# useradd -M -s /sbin/nologin Nginx
[root@localhost sbin]# Nginx -t
Nginx: the configuration file /usr/local/Nginx/conf/Nginx.conf Syntax is ok
Nginx: configuration file /usr/local/Nginx/conf/Nginx.conf test is successful
[root@localhost html]# Nginx
[root@localhost html]# firefox 192.168.1.10
PHP服务搭建
解压所需安装包并进行编译安装
[root@localhost ~]# tar zxf libmcrypt-2.5.8.tar.gz -C /usr/src/
[root@localhost ~]# tar zxf mcrypt-2.6.8.tar.gz -C /usr/src/
[root@localhost ~]# tar zxf mhash-0.9.9.9.tar.gz -C /usr/src/
[root@localhost ~]# tar zxf PHP-7.2.17.tar.gz -C /usr/src/
[root@localhost ~]# tar zxf ZendGuardLoader-PHP-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/libmcrypt-2.5.8/
[root@localhost libmcrypt-2.5.8]# ./configure && make && make install
[root@localhost libmcrypt-2.5.8]# cd ../mhash-0.9.9.9/
[root@localhost mhash-0.9.9.9]# ./configure && make && make install
[root@localhost mhash-0.9.9.9]# ln -s /usr/local/lib/libm* /usr/lib
创建一个软连接
[root@localhost mhash-0.9.9.9]# cd ../mcrypt-2.6.8/
[root@localhost mcrypt-2.6.8]# export LD_LIBRARY_PATG=$LD_LIBRARY_PATH:/usr/bin
[root@localhost mcrypt-2.6.8]# ./configure
[root@localhost mcrypt-2.6.8]# make
[root@localhost mcrypt-2.6.8]# make install
[root@localhost mcrypt-2.6.8]# yum -y install libxml2-devel zlib-devel
[root@localhost PHP-7.2.17]# yum -y install libjpeg-devel libpng-devel gd
[root@localhost PHP-7.2.17]# yum -y install libvpx-devel
[root@localhost PHP-7.2.17]# yum -y install libjpeg-devel
[root@localhost PHP-7.2.17]# yum -y install libpng-devel
[root@localhost PHP-7.2.17]# yum -y install libcurl-devel
[root@localhost PHP-7.2.17]# ./configure --prefix=/usr/local/PHP --enable-mbstring --with-mcryqt --with-config-file-path=/usr/local/PHP/etc --with-MysqL=/usr/local/MysqL --with-mhash --enable-fpm --with-jpeg-dir --with-png-dir --with-zlib-dir --with-gd --with-curl --with-pdo-MysqL
[root@localhost PHP-5.6.5]# make
[root@localhost PHP-5.6.5]# make install
[root@localhost PHP-5.6.5]# cp PHP.ini-development /usr/local/PHP/etc/PHP.ini
[root@localhost etc]# cp -p PHP-fpm.conf.default PHP-fpm.conf
[root@localhost etc]# ln -s /usr/local/PHP/sbin/PHP-fpm /usr/local/sbin/
[root@localhost etc]# vim PHP.ini
hort_open_tag = On 202行
[root@localhost etc]# vim PHP-fpm.conf
user = Nginx 149行
group = Nginx 150行
listen = 192.168.1.10:9000 164行
[root@localhost html]# cd /usr/local/Nginx/conf/
[root@localhost conf]# vim Nginx.conf
index index.html index.htm index.PHP; 45行
try_files $uri $uri/ /cf/index.PHP?$query_string; 46 行
location ~ \.PHP$ {
root /www;
fastcgi_pass 192.168.1.10:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
[root@localhost logs]# cat Nginx.pid
7148
[root@localhost logs]# kill -QUIT 7148
[root@localhost logs]# Nginx
[root@localhost /]# mkdir /www
[root@localhost /]# cd /www
[root@localhost www]# vim index.PHP
<?PHP
PHPinfo();
?>
[root@localhost html]# firefox 192.168.1.10/index.PHP
进入数据库 创建库
[root@localhost ~]# MysqL -u root
MysqL> CREATE DATABASE wordpress;
MysqL> CREATE USER 'user'@'192.168.1.%' IDENTIFIED BY '123456';
MysqL> GRANT ALL PRIVILEGES ON wordpress.* TO 'user'@'192.168.1.%' IDENTIFIED BY '123456';
MysqL> flush privileges;
下载wordoress包
[root@localhost ~]# cd /www/
[root@localhost www]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz
[root@localhost www]# tar zxvf latest-zh_CN.tar.gz
[root@localhost www]# rm -rf index.PHP
[root@localhost www]# mv wordpress/* ./
[root@localhost www]# cp wp-config-sample.PHP wp-config.php
[root@localhost www]# vim wp-config.php
添加权限
[root@localhost www]# cd ..
[root@localhost www]# chmod 777 -R /www
[root@localhost www]# ngins -s stop
[root@localhost www]# Nginx
[root@localhost www]# systemctl restart MysqLd
[root@localhost www]# systemctl stop PHP-fpm
[root@localhost www]# systemctl start PHP-fpm
[root@localhost www]# firefox 127.0.0.1
创建账户密码后登录
搭建到这里就完事了
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。