1. 給 Mysql 的數據目錄建立單獨的邏輯卷mkdir /mydata
#建立存放數據的目錄
fdisk /dev/sda
#新建分區屬性爲8e
pvcreate /dev/sda5
vgcreate myvg /dev/sda5
lvcreate –L 4G –n mylv myvg
mke2fs –L MYDATA –j /dev/myvg/mylv
vim /etc/fstab
LABEL=MYDATA /mydata ext3 defaults 0 0
#加入這一行實現開機自動掛載
mount –a
mkdir /mydata/data
2. 建立mysql用戶
groupadd –g 3306 mysql
useradd –g 3306 –u 3306 –M –s /sbin/nologin
chown –R mysql:mysql /mydata
3. 解壓mysql-5.5.15-linux2.6-i686.tar.gz,使用其中腳本進行初始化
tar xvf mysql-5.5.15-linux2.6-i686.tar.gz –C /usr/local/
cd /usr/local
ln –vs mysql-5.5.15-linux2.6-i686 mysql
cd /usr/local/mysql
chown –R mysql:mysql ./*
scripts/mysql_install_db --user=mysql --datadir=/mydata/data
#初始化Mysql用戶和數據路徑
chown –R root ./*
#再將屬主交還給root
4. 建立mysqld服務
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#導入服務腳本
chkconfig –add mysqld
5. 建立Mysql的配置文件
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
vim /etc/my.cnf
#找到[mysqld]下面的內容添加
datadir= /mydata/data
6. 加入mysql命令
vim /etc/profile
PATH=$PATH:/usr/loca/mysql/bin
#添加這一行
7. 加入mysql庫文件的路徑
vim /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib
#寫入這一行
8. 設置頭文件
ln –vs /usr/local/mysql/include /usr/include/mysql
9. 添加man文件(若是你之後不想使用mysql的man文件不添加也是能夠的)vim /etc/man.conf
MANPATH /usr/local/mysql/man
#添加這一行service mysql start
#啓動mysql服務
netstat –tnl
#查看3306端口處於監聽狀態,說明已經配置成功。
1.解壓httpd-2.2.19.tar.bz2軟件包
tar xvf httpd-2.2.19.tar.bz2
2. 設置安裝規則、編譯、安裝
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable=ssl --enable-modules=most --enable-mods-share=most --enable-so
make
make install
3. 製做服務啓動腳本
vim /etc/init.d/httpd#!/bin/bash
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
HTTPD_LANG=${HTTPD_LANG- "C"}
INITLOG_ARGS=""
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
#注意此上兩行中路徑要與你的安裝路徑一致
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/ lock/subsys/httpd}
RETVAL=0
start() {
echo -n $ "Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $ "Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $ "Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/ null; then
RETVAL=$?
echo $ "not reloading due to configuration syntax error"
failure $ "not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $ "Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
vim /etc/httpd/httpd.conf
PidFile "/var/run/httpd.pid"
#添加這一行
chkconfig --add httpd
service httpd start
#啓動httpd服務
netstat -tnl
#查看80端口處於監聽狀態,說明已經配置成功。
1. 解壓php-5.3.6.tar.bz2軟件包
tar xvf php-5.3.6.tar.bz2
2. 設置安裝選項、編譯、安裝
./configure --prefix=/usr/local/php5 --sysconfdir=/etc/php --enable-mbstring --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-libmcrypt --with-gd --with-mysqli
make
makeinstall
3. 加入命令路徑
vim /etc/profile
PATH=$PATH:/usr/loca/php5/bin
#添加這一行
4. 加入php庫文件路徑
vim /etc/ld.so.conf.d/php.conf
/usr/local/php5/lib
5. 建立php配置文件
cp php.ini-production /usr/local/php5/lib/php.ini
#注意php.ini-production文件位於php-5.3.6.tar.bz2的解壓目錄
6. 修改httpd服務配置文件使其支持php
vim /etc/httpd/httpd.conf
AddType Application/x-httpd-php .php
AddType Application/x-httpd-php-source .phps
#添加這兩行在AddType xxxxxx行附近位置
DirectoryIndex index.php index.html
#添加index.php
service httpd restart
#重啓httpd服務
1. 配置虛擬主機
vim /etc/httpd/httpd.conf
#DocumentRoot "/usr/local/apache/htdocs"
#把此行註釋
Include /etc/httpd/extra/httpd-vhosts.conf
#把此行啓用
vim /etc/httpd/extra/httpd-vhosts.conf
#添加內容
<VirtualHost *:80>
DocumentRoot "/web/phpmyadmin" #網站所在目錄
ServerName "phpmyadmin.redhat_hu.com" #虛擬主機名
ErrorLog "logs/phpmyadmin.error" #錯誤日誌
CustomLog "logs/phpmyadmin.access" combined #訪問日誌
</VirtualHost>
<Directory "/web/phpmyadmin">
Order allow,deny
Allow from all
</Directory>
#設置訪問控制爲容許全部
<VirtualHost *:80>
DocumentRoot "/web/wordpress"
ServerName "wordpress.redhat_hu.com"
ErrorLog "logs/wordpress.error"
CustomLog "logs/wordpress.access" combined
</VirtualHost>
<Directory "/web/wordpress">
Order allow,deny
Allow from all
</Directory>
2.配置網站連接數據庫
mkdir /web/{phpmyadmin,wordpress}
#建立網頁所在目錄 (此目錄最好掛載邏輯卷,具體步驟見上文)
tar xvf phpMyAdmin-3.4.3.2-all-languages.tar.bz2
cp -R phpMyAdmin-3.4.3.2/* /web/phpmyadmin
unzip wordpress-3.0.4-zh_CN.zip
cp -R wordpress/* /web/ wordpress
#將兩個網站文件放入對應文件夾
mv /web/wordpress/wp-config-simple.php /web/wordpress/wp-config.php
vim /web/wordpress/wp-config.php
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', 'redhat');
#設置對應數據庫名登陸用戶以及密碼
在mysql中建立數據庫
mysql
#未設置密碼能夠直接登陸
mysql>CREATE DATABASE wordpress;
mysql>SET PASSWORD FOR root@localhost=PASSWORD('redhat');
mysql>FLUSH PRIVILEGES;
#設置密碼redhat
mysql>quit