LAMP复习
准备
第一步:准备安装包(由于下载速度感人,转移原有资源压缩包)
开启复习机139、资源机138。139登录138,将压缩包包放一个地方,rsync推给139
ssh 192.168.83.138cd /usr/local/src mkdir aaa for i in *tar*;do mv $i aaa ; donels aaa
rsync -auvLP /usr/local/src/aaa/ 192.168.83.139:/usr/local/src/[ctrl-d] 登出到139复习机
批量解压
yum install -y bzip2 for i in *tar*;do tar zxvf $i || tar jxvf $i;done
- 默认没装bzip2 报错没目录啥的,别被误导!
- 做个快照
安装MySQL
yum install -y libaioyum install -y perl-Data-Dumper mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql./scripts/mysql_install_db --user=mysql --datadir=/data/mysql echo $? //alias aa='echo $?'
- 安装报错解决
调整配置文件,服务文件
vi /etc/my.cnf 自带的直接用,没有就从support目录下找一个粘锅来 datadir=/data/mysql socket=/tmp/mysql.sock #cd support-files/ ls mv mysql.server /etc/init.d/mysqld vi !$ basedir=/usr/local/mysql datadir=/data/mysqchkconfig --add mysqld chkconfig --list service mysqld startps aux | grep mysql
安装Apache
cd /usr/local/src/apr-1.5.2/yum install -y gcc./configure --prefix=/usr/local/aprmake && make installcd ../apr-util-1.5.4/./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make installcd ../httpd-2.4.27/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=mostmake && make install/usr/local/apache2.4/bin/apachectl start
- 注意:启动提示就是ServerName没事 ps aux 看下启动了就行
安装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
显示Info
iptables -I INPUT -p tcp --dport 80 -j ACCEPT serviec iptables savecd /usr/local/apache2.4vim conf/httpd.conf ServerName 删“#” 作为默认主机名 www.example.com 可以curl这个 Requrie 改 granted AddType 加 AddType application/x-httpd-php .php //这里配错语法监测不出来 DirectoryIndex 加 index.phpvi htdocs/1.php bin/apachectl -t bin/apachectl graceful