RedHat5.4搭建LAMP
環境準備:
我的環境:Red Hat Enterprise Linux Server release 5.4
所需軟體包:
apr-1.4.6.tar.gz
httpd-2.4.2.tar.bz2
php-5.4.4.tar.gz
apr-util-1.4.1.tar.gz
libmcrypt-2.5.7.tar.gz
cmake-2.8.6.tar.gz
mysql-5.5.25.tar.gz
輔助包:
ncurses-devel.i386
pcre-devel
libxml2
安裝配置過程:
安裝cmake編譯工具
[root@orcl10g LAMP]# tar zxvf cmake-2.8.6.tar.gz
[root@orcl10g LAMP]# cd cmake-2.8.6
[root@orcl10g cmake-2.8.6]# ./configure
[root@orcl10g cmake-2.8.6]# make
[root@orcl10g cmake-2.8.6]# make install
檢視cmake是否安裝成功
[root@orcl10g cmake-2.8.6]# which cmake
/usr/local/bin/cmake
安裝libmcrypt-2.5.7
[root@orcl10g LAMP]# tar zxvf libmcrypt-2.5.7
[root@orcl10g LAMP]# cd libmcrypt-2.5.7
[root@orcl10g libmcrypt-2.5.7]# ./configure
編譯:
[root@orcl10g libmcrypt-2.5.7]# make
安裝:
[root@orcl10g libmcrypt-2.5.7]# make install
安裝mysql
新增mysql使用者組
[root@orcl10g LAMP]# groupadd mysql
建立mysql使用者,不允許其直接登入系統
[root@orcl10g LAMP]# useradd -g mysql -s /sbin/nologin mysql
建立mysql 的資料存放路徑並設定目錄許可權
[root@orcl10g mysql-5.5.25]# mkdir -p /mysql/data
[root@orcl10g mysql-5.5.25]# chown -R mysql:mysql /mysql/data
解壓安裝包:
[root@orcl10g LAMP]# tar zxvf mysql-5.5.25.tar.gz
[root@orcl10g LAMP]# cd mysql-5.5.25
cmake配置使安裝路徑為/usr/local/mysql5字符集設定為all
[root@orcl10g mysql-5.5.25]# cmake -DECMAKE_INSTALL_PREFIX=/usr/local/mysql5 -DEXTRA_CHARSETS=all
執行會出如下錯誤:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:127 (FIND_CURSES)
cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:257 (MYSQL_CHECK_READLINE)
-- Configuring incomplete, errors occurred!
提示的很明顯,需要安裝ncurses-devel包,在映象裡找到該包並安裝,yum安裝更方便:
[root@orcl10g ~]# yum install ncurses-devel -y
刪除ncurses-devel再次執行cmake命令
[root@orcl10g LAMP]# cd mysql-5.5.25
[root@orcl10g mysql-5.5.25]# rm -rf CMakeCache.txt
[root@orcl10g mysql-5.5.25]# cmake -DECMAKE_INSTALL_PREFIX=/usr/local/mysql5 -DEXTRA_CHARSETS=all
[root@orcl10g mysql-5.5.25]# make
[root@orcl10g mysql-5.5.25]# make install
新增資料存放路徑:
[root@orcl10g apache2]# vi /etc/my.cnf
[mysqld]
新增
datadir = /mysql/data
新增root密碼
[root@orcl10g apache2]# /usr/local/mysql/bin/mysqladmin -u root password 123456
登入測試:
[root@orcl10g apache2]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.25-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql>
[root@orcl10g mysql]# cp ./support-files/my-medium.cnf /etc/my.cnf
生成測試資料庫:
[root@orcl10g mysql]# /usr/local/mysql/scripts/mysql_install_db --user=mysql
啟動資料庫
[root@orcl10g mysql-5.5.25]# /usr/local/mysql/bin/mysqld --user=mysql
安裝配置apache2
安裝apr-1.4.6
[root@orcl10g LAMP]# tar zxvf apr-1.4.6.tar.gz
[root@orcl10g LAMP]# cd apr-1.4.6
[root@orcl10g apr-1.4.6]# ./configure --prefix=/usr/local/apr-httpd/
[root@orcl10g apr-1.4.6]# make
[root@orcl10g apr-1.4.6]# make install
安裝apr-util-1.4.1
[root@orcl10g apr-1.4.6]# cd ..
[root@orcl10g LAMP]# tar zxvf apr-util-1.4.1.tar.gz
[root@orcl10g LAMP]# cd apr-util-1.4.1
[root@orcl10g apr-util-1.4.1]# ./configure --prefix=/usr/local/apr-util-httpd/
--with-apr=/usr/local/apr-httpd/
[root@orcl10g apr-util-1.4.1]# make & make install
解壓安裝apache
[root@orcl10g LAMP]# tar ixvf httpd-2.4.2.tar.bz2
[root@orcl10g LAMP]# cd httpd-2.4.2
指定安裝路徑,並允許讀寫,指派剛安過的apr和apr-util路徑
[root@orcl10g httpd-2.4.2]# ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
執行會報錯:
configure: error: pcre-config for libpcre not found. PCRE is required and available from
需要安裝依賴包pcre-devel.i386:
映象中找到pcre-devel或者使用yum安裝
[root@orcl10g httpd-2.4.2]# yum install pcre* -y
Installed:
pcre-devel.i386 0:6.6-2.el5_1.7
Complete!
重新執行./configure命令
[root@orcl10g httpd-2.4.2]# ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
編譯
[root@orcl10g httpd-2.4.2]# make
安裝
[root@orcl10g httpd-2.4.2]# make install
啟動apache2
[root@orcl10g httpd-2.4.2]# /usr/local/apache2/bin/apachectl start
如果報以下錯誤,需修改一下配置檔案:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[root@orcl10g httpd-2.4.2]# vi /usr/local/apache2/conf/httpd.conf
加入ServerName
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName
ServerName localhost:80
再次啟動apache
[root@orcl10g httpd-2.4.2]# /usr/local/apache2/bin/apachectl start
[root@orcl10g httpd-2.4.2]# /usr/local/apache2/bin/apachectl
httpd (pid 15249) already running
安裝php
解壓php包
[root@orcl10g LAMP]# tar zxvf php-5.4.4.tar.gz
[root@orcl10g LAMP]# cd php-5.4.4
配置:
./configure --prefix=/usr/local/php5/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --enable-mbstring
提示報錯:
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
缺少 libxml2包
[root@orcl10g php-5.4.4]# yum install libxm*
再次執行配置:
[root@orcl10g php-5.4.4]# ./configure --prefix=/usr/local/php5/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --enable-mbstring
編譯
[root@orcl10g php-5.4.4]#make
安裝
[root@orcl10g php-5.4.4]#make install
測試:
[root@orcl10g ~]# cd /usr/local/apache2/htdocs/
[root@orcl10g htdocs]# vi index.php
寫入內容如下:
phpinfo();
?>
瀏覽器端檢視php資訊:
輸入檢視服務
php資訊:
apache資訊
mysql資訊
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29320885/viewspace-1064016/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LAMP搭建示例LAMP
- Ubuntu搭建LAMPUbuntuLAMP
- php環境搭建---LAMPPHPLAMP
- Centos6.5搭建LAMPCentOSLAMP
- Centos7.2搭建LampCentOSLAMP
- centos7lamp搭建CentOSLAMP
- 搭建高效能LAMP架構:LAMP+FastCGI薦LAMP架構AST
- Centos下搭建LAMP+PHPCentOSLAMPPHP
- Ubuntu14.04搭建LAMPUbuntuLAMP
- Ubuntu16.04搭建LAMPUbuntuLAMP
- linux搭建lamp環境LinuxLAMP
- lamp 以及ucenter、phpBB、discuz! 搭建LAMPPHP
- 編譯搭建LAMP伺服器編譯LAMP伺服器
- LAMP環境搭建-MySQL5.6LAMPMySql
- 【轉】 Windows下LAMP環境搭建WindowsLAMP
- LAMP(CentOS 7.2)環境下搭建WordPressLAMPCentOS
- CentOS 7.3搭建LAMP環境和WordpressCentOSLAMP
- linux中lamp的搭建(rpm)LinuxLAMP
- CentOS7.3 編譯搭建 lamp 環境CentOS編譯LAMP
- centos7.3搭建lamp實現使用wordpressCentOSLAMP
- Linux下原始碼搭建LAMP環境Linux原始碼LAMP
- 搭建LAMP中安裝PHP遇到的故障LAMPPHP
- CentOS6.7原始碼搭建LAMP平臺CentOS原始碼LAMP
- lamp環境搭建與phpwind,wordprss實現LAMPPHP
- CentOS7.0 LAMP環境搭建(MariaDB)CentOSLAMP
- Linux-LAMP平臺搭建詳解LinuxLAMP
- LAMP--原始碼MySQL叢集版搭建LAMP原始碼MySql
- LAMP-CentOS7搭建Web伺服器LAMPCentOSWeb伺服器
- 搭建lamp環境以及安裝配置phpmyadminLAMPPHP
- Lamp(linux+apache+mysql+php)環境搭建LAMPLinuxApacheMySqlPHP
- PHP開發大牛必修課——LAMP平臺搭建PHPLAMP
- redhat5.4 雙網路卡 bondingRedhat
- CentOS下搭建LAMP環境及遇到的問題CentOSLAMP
- RHEL5.3下搭建LAMP+Django環境(二)LAMPDjango
- Linux下Lamp(rpm包)搭建+網頁管理mysqlLinuxLAMP網頁MySql
- Mac下使用Brew搭建PHP(LNMP/LAMP)開發環境MacPHPLNMPLAMP開發環境
- LAMPLAMP
- 在原始碼安裝的LAMP環境中搭建Nagios原始碼LAMPiOS