lamp源碼安裝


yum install lrzsz -y   在linux裏可代替ftp上傳和下載  php

rz 上傳
html

sz  + filename  下載mysql


安裝 apache2.4 linux

1.1安裝 apr c++

yum -y install epel-release sql

wget -c http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz tar xf apr-1.5.2.tar.gz  數據庫

cd apr-1.5.2   ./configure --prefix=/usr/local/apr;apache

echo $? bash

make && make install;app

echo $?      

1.2 安裝 apr-util  

wget -c http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz 

tar xf apr-util-1.5.2.tar.gz  

cd apr-util-1.5.2 

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr;

echo $? 

make && make install;

echo $?           

1.3 安裝 httpd2.4.12 

wget -c http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gz 

yes|yum install pcre-devel openssl-devel 

tar xf httpd-2.4.12.tar.gz  

[root@localhost ~]# cd httpd-2.4.12 
[root@localhost httpd-2.4.12]# ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event;echo $? 
[root@localhost httpd-2.4.12]# make && make install;echo $?

源碼安裝LAMP之MySQL

2.1環境準備

yes | yum install gcc gcc-c++ make cmake  ncurses-devel bison perl

groupadd mysql 

useradd -r -g mysql mysql 

mkdir /usr/local/mysql/        #建立mysql安裝目錄 

mkdir /data/mysql               #建立數據存放目錄 

chown mysql:mysql -R /data/mysql 


2.2.2#開始安裝   

wget –c http://download.softagency.net/MySQL/Downloads/MySQL-5.5/mysql-5.5.44.tar.gz tar xf mysql-5.5.44.tar.gz 

cd  mysql-5.5.44 

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306;

echo $? 

make && make install ;echo $?


2.2.三、初始化MySQL

cp support-files/my-medium.cnf /etc/my.cnf          #複製配置文件 

cp support-files/mysql.server /etc/init.d/mysqld    #複製啓動腳本 

chmod 755 /etc/init.d/mysqld 

cd /usr/local/mysql      #進入安裝目錄 

chown -R mysql.mysql . # 受權                                        

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql  #初始化數據庫 

/etc/init.d/mysqld start                                           #啓動數據庫 

 

2.2.四、MySQL配置

chkconfig --add mysqld                                 #添加系統服務 

chkconfig mysqld on                                     #添加開機啓動 

export PATH=$PATH:/usr/local/mysql/bin    #添加環境變量  

echo 'PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile 

service mysqld start/stop 

 

2.3 編譯安裝 PHP

 

2.3.1 安裝 PHP 依賴包  

wget -c http://au1.php.net/distributions/php-5.4.42.tar.bz2  

yes|yum install libxml2-devel  libmcrypt-devel bzip2-devel libxml2-devel openssl-devel  bzip2 bzip2-devel

rpm -ivh "http://www.aminglinux.com/bbs/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm"

yum install -y  libmcrypt-devel      

  

2.3.2 安裝 PHP   

 tar xf php-5.4.42.tar.bz2  

 cd  php-5.4.42

 ./configure  --prefix=/usr/local/php  --with-apxs2=/usr/local/apache/bin/apxs  --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql  --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  --disable-ipv6 --with-pear   --with-curl --with-openssl --with-mysqli --enable-mysqlnd --with-gettext  --enable-bcmath --enable-sockets

make && make install ;echo $?



源碼安裝Apache+PHP整合

 

修改httpd.conf配置文件

vi /usr/local/apache/conf/httpd.conf

而後加入以下語句:

LoadModule     php5_modulemodules/libphp5.so(默認已存在)

AddType     application/x-httpd-php .php

DirectoryIndex  index.php index.html (把index.php加入index.html以前)

而後在/usr/local/apache/htdocs目錄下建立index.php測試頁面,執行以下命令:

cat >>/usr/local/apache/htdocs/index.php <<EOF

<?php

phpinfo();

?>

EOF

從新啓動apache服務,經過IP訪問界面以下圖,即表明LAMP環境搭建成功。

wKioL1WaLRrgsXD6AAH1sQgpV-Y533.jpg

相關文章
相關標籤/搜索