11-1 11 LAMP複習 安裝

LAMP複習

準備

第一步:準備安裝包(因爲下載速度感人,轉移原有資源壓縮包)php

開啓複習機13九、資源機138。139登陸138,將壓縮包包放一個地方,rsync推給139mysql

ssh 192.168.83.138
cd /usr/local/src 
mkdir aaa 
for i in *tar*;do mv $i aaa ; done
ls aaa

rsync -auvLP /usr/local/src/aaa/ 192.168.83.139:/usr/local/src/
[ctrl-d] 登出到139複習機

批量解壓linux

yum install -y bzip2 
for i in *tar*;do tar zxvf $i || tar jxvf $i;done
  • 默認沒裝bzip2 報錯沒目錄啥的,別被誤導!
  • 作個快照

安裝MySQL

yum install -y libaio
yum 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 $?'
  • 安裝報錯解決

調整配置文件,服務文件sql

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/mysq
chkconfig --add mysqld 
chkconfig --list 
service mysqld start
ps aux | grep mysql

安裝Apache

cd /usr/local/src/apr-1.5.2/
yum install -y gcc
./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/
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
  • 注意:啓動提示就是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 save
cd /usr/local/apache2.4
vim conf/httpd.conf 
	ServerName 刪「#」 做爲默認主機名 www.example.com 能夠curl這個
	Requrie 改 granted
	AddType 加 AddType application/x-httpd-php .php  //這裏配錯語法監測不出來
	DirectoryIndex  加 index.php
vi htdocs/1.php 
	<?php phpinfo(); ?>
bin/apachectl -t 
bin/apachectl graceful

相關文章
相關標籤/搜索