LAMP練習

LAMP練習

克隆新機

vi /etc/sysconfig/network-scripts/ifcfg-ens33
	刪UUID
	改IP爲.138
hostnamectl set-hostname axiang-02

同步資源

rsync -auvLP 192.168.83.137:/usr/local/src/ /usr/local/src/  //拉資源
ls | xargs -n1 tar zxvf //所有.tar.gz解壓

安裝mysql

mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
cd ../mysql/
useradd mysql
mkdir /data/
yum install -y libaio
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
echo $?
vi /etc/my.cnf
	datadir=/data/mysql
	socket=/tmp/mysql.sock
	#
bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql  --datadir=/data/mysql &  //命令啓動 須要重啓失效
ps aux | grep mysqld
history | awk '{for(i=2;i<=NF;++i) printf $i " ";printf "\n"}' //用於製做導圖

安裝apache

cd ../src/apr-1.5.2/
./configure --prefix=/usr/local/apr
make && make install
cd ../apr-util-1.5.4/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd ../httpd-2.4.27/
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
yum list | grep pcre
yum install -y pcre-devel
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
make && make install
/usr/local/apache2.4/bin/apachectl start

安裝php5

cd /usr/local/src/php-5.6.30/ 
yum install -y libxml2-devel 
yum install -y openssl-devel 
yum install -y bzip2-devel 
yum install -y libjpeg-devel 
yum install -y libpng-devel 
yum install -y freetyp-devel 
yum install -y freetype-devel 
yum install -y libmcrypt-devel 
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif 
make && make install 
cp php.ini-production /usr/local/php/etc/php.ini 
	檢查
		/usr/local/php/bin/php -i |less 
		ls /usr/local/apache2.4/modules/libphp5.so

安裝php7

cd /usr/local/src/php-7.1.6/ 
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif 
make && make install
cp php.ini-production /usr/local/php7/etc/php.ini

顯示Info

iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
cd /usr/local/apache2.4
vim conf/httpd.conf 
	libphp 保留一個
	ServerName 刪「#」
	Requrie 改 granted
	AddType 加 AddType application/x-httpd-php .php
	DirectoryIndex  加 index.php
vi htdocs/1.php 
	<?php phpinfo(); ?>
bin/apachectl -t 
bin/apachectl graceful 
bin/apachectl restart

相關文章
相關標籤/搜索