Apache部署
1. 连接Xshell,配置ip,关闭防火墙(systemctl stop firewalld),关闭内核机制(setenforce 0)
2. 把在官网下载的压缩包拖到Xshell终端里,需要的包(httpd-2.4.50.tar.gz)
3. md5sum httpd-2.4.50.tar.gz
4. rpm -q httpd
mkdir /media/cdrom
mount /dev/sr0 /media/cdrom
cd /etc/yum.repos.d
mkdir bak
mv C* bak
cp bak/CentOS-Media.repo ./
vim CentOS-Media.repo
cd
5. yum clean all && yum makecache
6. yum install -y gcc gcc-c++ make apr-util-devel pcre-devel
echo $?
7. tar zxvf httpd-2.4.50.tar.gz -C /usr/src
echo $?
cd /usr/src/httpd-2.4.50
8. ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
echo $?
make
9. make install
echo $?
cd /usr/local/httpd
10. ln -s /usr/local/httpd/bin/* /usr/local/bin
echo $PATH
11. vim /lib/systemd/system/httpd.service
[Unit] Description=The Apache httpd service After=network.target
[Service] Type=forking PIDFILE=/usr/local/httpd/logs/httpd.pid ExecStart=/usr/local/httpd/bin/apachectl $OPTIONS ExecReload=/bin/kill -HUP $MAINPID
[Install] WantedBy=multi-user.target
12. systemctl daemon-reload
13. systemctl enable httpd
14. cd /usr/local/httpd/conf
15. cp /usr/local/httpd/conf/httpd.conf{ , . bak}
16. vim httpd.conf
202行 ServerName www.kgc.om:80
echo $PATH
17. apachectl -t
18. systemctl start httpd
19. netstat -anpt |grep httpd
20. vim /etc/hosts
192.168.10.10 www.kgc.com
去本机浏览器上验证
mysql部署
1. 关机
2. 关闭防火墙(systemctl stop firewalld),关闭安全机制(setenforce 0)
3. netstat -anpt |grep httpd
4. 把压缩包(cmake-2.8.6.tar.gz and mysql-5.6.36.tar.gz)拖到控制面板
5. rpm -q mariadb*
6.mount /dev/sr0 /media/cdrom
7. yum install -y gcc gcc-c++ libaio ncurses-devel openssl openssl-devel autoconf
8. tar zxvf cmake-2.8.6.tar.gz -C /usr/src
9.cd /usr/src/cmake-2.8.6
10. ./configure
eho $?
11. gmake && gmake install
echo $?
cd
12. tar zxvf mysql-5.6.36.tar.gz -C /usr/src
cd /usr/src/mysql-5.6.36
13. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
echo $?
14. make -j 4
echo $?
15. make install
echo $?
cd
16. groupadd mysql
17. useradd -M -s /sbin/nologin mysql -g mysql
18. ls -ld /usr/local/mysql
19. chown -R mysql:mysql /usr/local/mysql
ls -ld /usr/local/mysql
20. /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
echo $?
21. vim /etc/my.cnf
清空内容
22.
[mysqld]
port=3306
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
user=mysql
max_connections=100
symbolic-links=0
lower_case_table_names=1
character-set-server=utf8
collation-server=utf8_general_ci
bind-address=0.0.0.0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/usr/local/mysql/mysql.sock
23. cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
24. service mysqld start
25. netstat -anpt |grep mysqld
26. echo $PATH
27. vim /etc/profile
28. export PATH=$PATH:/usr/local/mysql/bin (在配置文件的最后一行添加)
29. source /etc/profile
echo $PATH
cd
30. mysql -u root -p
show databases;
mysqladmin -u root password "123456"
PHP部署
1. 关闭防火墙 (systemctl stop firewalld),关闭内核安全机制(setenforce 0),查看apache是否开启 (netstat -anpt |grep httpd),查看mysqld是否开启(netstat -anpt |grep mysqld)
2. rpm -qa php*
3. 把压缩包托到控制面板(libmcrypt-2.5.8.tar.gz ,mcrypt-2.6.8.tar.gz ,mhash-0.9.9.9.tar.gz ,php-5.5.38.tar.gz ,phpMyAdmin-4.7.2-all-languages.tar.gz ,zend-loader-php5.5-linux-x86_64_update1.tar.gz)
检查关盘是否挂载
4. yum install -y zlib-devel libxml2 libxml2-devel xz-devel
5. tar zxvf libmcrypt-2.5.6.tar.gz -C /usr/src
cd /usr/src/libmcrypt-2.5.8
6. ./configure && make && make install
echo $?
cd
7. ln -s /usr/local/lib/libmcrypt.* /usr/lib
8. tar zxvf mhash-0.9.9.9.tar.gz -C /usr/src
9. cd /usr/src/mhash-0.9.9.9
10. ./configure && make && make install
echo $?
cd
11. ln -s /usr/local/lib/libmhash* /usr/lib
12. tar zxvf mcrypt-2.6.8.tar.gz -C /usr/src
cd /usr/src/mcrypt-2.6.8
13. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
14. ./configure
echo $?
15. make && make install
echo $?
cd
16. tar zxvf php-5.5.38.tar.gz -C /usr/src
cd /usr/src/php-5.5.38
17. ./configure --prefix=/usr/local/php5 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php5 --enable-mbstring
echo $?
18. make && make install
echo $?
cd
cd /usr/local/php5
19. cp /usr/src/php--5.5.38/php.ini-development /usr/local/php5/php.ini
20. vim /usr/local/php5/php.ini
21. 202行 short_open_tag = On
680行 default_charset = "UTF-8"
873行 extension=php_mysqli.dll
910行 date.timezone = Asia/beijing
1185行 mysqli.default_socket = /usr/local/mysql/mysql.sock
22. tar zxvf zend-loader-php5.5-linux-x86_64_update1.tar.gz -C /usr/src
cd /usr/src/zend-loader-php5.5-linux-x86_64
23. cp ZendGuardLoader.so /usr/local/php5/lib/php
24. vim /usr/local/php5/php.ini
25. 341行添加 zend_extension = /usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enable = 1
26. vim /usr/local/httpd/conf/httpd.conf
27.
apachectl -t
28. systemctl restart httpd
29. cd /usr/local/httpd/htdocs
30. vim test1.php
<?php
$link=mysqli_connect('localhost','root','123456');
if($link) echo "恭喜您,链接数据库成功";
mysqli_close($link);
?>