在CentOS5.2上,編譯LAMP的,兩年前測試通過的,現在留印
### 在記事本中 ,不要打開 自動換行,否則一些命令 無法正常運行###把源文件考到/src/目錄下,然后進入/src/////////////////////////////////////////////////////////////////////
cd /srctar zxvf autoconf-2.61.tar.gz tar zxvf libxml2-2.6.30.tar.gztar zxvf freetype-2.3.5.tar.gztar zxvf MySQL-5.1.67.tar.gztar zxvf gd-2.0.35.tar.gztar zxvf httpd-2.2.9.tar.gztar zxvf php-5.2.6.tar.gztar zxvf jpegsrc.v6b.tar.gztar zxvf phpMyAdmin-3.0.0-rc1-all-languages.tar.gztar zxvf libmcrypt-2.5.8.tar.gztar zxvf ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gztar zxvf libpng-1.2.31.tar.gz tar zxvf zlib-1.2.3.tar.gztar zxvf ncurses-5.6.tar.gzrm -rf *.gz
cd /src/libxml2-2.6.30./configure --PRefix=/usr/local/libxml2 make && make install
cd /src/libmcrypt-2.5.8./configure --prefix=/usr/local/libmcrypt make && make install
cd /src/zlib-1.2.3./configuremake && make install
cd /src/libpng-1.2.31./configure --prefix=/usr/local/libpngmake && make install
cd /src/jpeg-6bmkdir /usr/local/jpeg6mkdir /usr/local/jpeg6/binmkdir /usr/local/jpeg6/libmkdir /usr/local/jpeg6/include mkdir -p /usr/local/jpeg6/man/man1./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-staticmake && make install
cd /src/freetype-2.3.5./configure --prefix=/usr/local/freetype make && make install
cd /src/autoconf-2.61./configuremake && make install
cd /src/gd-2.0.35./configure --prefix=/usr/local/gd2/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/
vi gd_png.c
///////////////////////////////////////////////////////////////////////////////////////////////////////////###### (上面的make未成功,修改完gd_png.c后,再做一次)### vi gd_png.c### 修改 #include "png.h" 為 #include "/usr/local/libpng/include/png.h" 即可。系統默認找不到### 注意下一行,可能不成功!!進入安裝目錄檢查,如不成,再做一次./configure###////////////////////////////////////////////////////////////////////////////////////////////////////////////
./configure --prefix=/usr/local/gd2/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/
make && make install
cd /src/httpd-2.2.9./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support make && make install
cd /src/ncurses-5.6./configuremake && make install
cd /src/mysql-5.1.67groupadd mysqluseradd -g mysql mysql./configure --prefix=/usr/local/mysql --with-extra-charsets=all make && make installcp /src/mysql-5.1.67/support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
cd /src/php-5.2.6./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
make && make install
cp /src/php-5.2.6/php.ini-dist /usr/local/php/etc/php.ini
vi /etc/httpd/httpd.conf
///////////////////////////////////////////////////////////////////////////////////////////###### vi /etc/httpd/httpd.conf ###### 在<IfModule mime_module> 節點 加入### Addtype application/x-httpd-php .php ### 讓它支持php為后綴的文件###### 在<Directory "/usr/local/apache2/htdocs">節點### 將 Options Indexes FollowSymLinks### 修改為 Options -Indexes FollowSymLinks### 從Indexs前加上減號。這樣即可關閉目錄瀏覽。### 在緊靠它的下面### 將AllowOverride None### 修改為 AllowOverride All### 這樣支持偽靜態###### 在<IfModule dir_module>節點### 將 DirectoryIndex index.html### 修改為 DirectoryIndex index.html index.php### 加上index.php。加上了默認索引頁。######////////////////////////////////////////////////////////////////////////////////////////////
cd /src/ZendOptimizer-3.2.6-linux-glibc21-i386./install.sh
////////////////////////////////////////////////////////////###### 輸入 php.ini的目錄### /usr/local/php/etc/###/////////////////////////////////////////////////////////////
cp -a /src/phpMyAdmin-3.0.0-rc1-all-languages /usr/local/apache2/htdocs/phpmyadmincd /usr/local/apache2/htdocs/phpmyadmin/cp config.sample.inc.php config.inc.phpvi config.inc.php
/////////////////////////////////////////////////////////////###### 加入一個密鑰### $cfg['blowfish_secret'] = "" ### 此處加入密鑰###//////////////////////////////////////////////////////////////
vi /etc/init.d/mysql
///////////////////////////////////////////////////////////###需粘貼的內容
#!/bin/sh#chkconfig:2345 50 20#description:TralinHotel Mysql 5.1.64 Server
case "$1" in'start')echo "Starting TralinHotel Mysql Database..."/usr/local/mysql/bin/mysqld_safe --user=mysql &;;esac
###### 存盤后,賦予權限 ###
chmod 777 /etc/init.d/mysql
vi /etc/init.d/apache
///////////////////////////////////////////需要粘貼的內容
#!/bin/sh#chkconfig:2345 40 10#description:TralinHotel Apache Http Server
case "$1" in'start')echo "Starting TralinHotel Apache Http Server..."/usr/local/apache2/bin/apachectl start;;'stop')echo "Stop TralinHotel Apache Http Server..."/usr/local/apache2/bin/apachectl stop;;'restart')echo "Restart TralinHotel Apache Http Server..."/usr/local/apache2/bin/apachectl restartesac
//////////////////////////////////////////存盤后,賦予權限//////////////////////////////////////////////chmod 777 /etc/init.d/apache
chkconfig --add mysqlchkconfig --add apache
///////////////////////////////////////////////
后續問題mysql的安全性mysql的字符集samba的win共享
///////////////////////////////////////////////
1.打開mysql的控制臺/usr/local/mysql/bin/mysql
a.設置安全性
mysql> select * from mysql.user /Gmysql> delete from mysql.user where host='localhost' and user = '';mysql> FLUSH PRIVILEGES;mysql> SET PASSWord FOR 'root'@'localhost' = PASSWORD('abc123');
b.設置字符集
未修改前 ,在查看 >status; 就可以看到4個latin1
vi /etc/my.cnf
在 [client] 節加入 default-character-set = utf8在[mysqld]節點加入character-set-server = utf8collation-server = utf8_general_ci
重啟后,輸入
/usr/local/mysql/bin/mysql -u root -p輸入密碼后,登陸后臺mysql> status;查看,對應四個utf8
shell監控
#######################################################################shell 腳本監控報警#######################################################################
service sendmail stopchkconfig sendmail off
##檢查pstree |grep sendmail
### 安裝postfix
yum -y install postfix*
### 安裝dovecot
yum -y install dovecot*
###配置postfix /etc/postfix/cd /etc/postfix
vi main.cf
#myhostname = host.domain.tld 改為##服務器主機名myhostname = mail.g.cn##服務器域名mydomian = g.cn
##發件人的@的后綴myorigin =$myhostnamemyorigin =$mydomain
###監聽接口,(將最下的那個注釋掉)inet_interfaces = all#inet_interfaces =localhost
###收郵件的后綴mydestination = $myhostname,$mydomain
###服務器所處網段mynetworks = 192.168.7.0/24, 127.0.0.0/8
###允許郵局轉發relay_domains = $mydestination
###啟動postfixservice postfix startpstree | grep masternetstat -tunpl |grep 25chkconfig postfix on
###設置默認的郵件轉發服務器 由sendmail制定為postfixalternatives --config mta出現的提升中,輸入編號,回車,即設定默認程序
###配置dovecot, /etc/dovecot.confvi /etc/dovecot.conf##將這行的注釋去掉protocols = imap imaps pop3 pop3s
service dovecot restartchkconfig devocot onnetstat -tunpl | grep 110
###寫腳本。### apache 關閉的報警
#!/bin/bash#apache.sh
nc -w2 localhost 80if [ $? -ne 0 ]then echo "apache's 80 port is down,please check. from xuyong"|mail 1213179416@QQ.com -s "tralin
apache is down"
/usr/local/apache2/bin/apachectl start
fi
####mysql的腳本
#!/bin/bash#mysql.sh
nc -w2 localhost 3306if [ $? -ne 0 ]then echo "mysql's 3306 port is down,please check form xuyong"|mail 1213179416@qq.com -s"mysql is
down" /usr/local/mysql/bin/mysqld_safe &
fi
####磁盤的腳本>80%
#!/bin/bash#disk.sh
num=`df |awk 'NR==3{print int($4)}'`if [ $num -ge 80 ]then echo "disk space is ${num}%,now > 80% "|mail 1213179416@qq.com -s "disk space > 80% warining!"fi
####測試dd if=/dev/zero of=test.txt bs=1M count=1000
###加入計劃任務###每5分鐘,執行一次,
crontab -e
*/5 * * * * /disk.sh*/5 * * * * /mysql.sh*/5 * * * * /apache.sh
crontab -l 查看計劃任務
#############################################################################################
清理root郵箱的
#############################################################################################
如果是全部清除,可用cp /dev/nulll /var/spool/mail/root
要刪除一封信,則在 mail 的提示符號下,使用命令
& d〔letter-number〕
例如,要刪除第二封信,可用如下的方式 & d 2
若欲刪除第一封到第三封信,則可下如下的命令 & d 1-3
若要殺掉全部的信,則可以使用 & d *
做root轉發,因為root不能遠程登錄收取郵件。所以做了一個別名。比如xuyong@tralinhotel.cn
vi /etc/aliases ← 編輯aliases,添加如下行到文尾
root: xuyong@tralinhotel.cn
newaliases← 重建aliasesdb
echo test | mail root← 發送測試郵件給root
#############################################################################################/
改源的,yum
#############################################################################################
REDHAT yum源修改成CENTOS 1,先將原來的YUM源備份#mv /etc/yum.conf /etc/yum.conf.bak#cp -a /etc/yum.repos.d /etc/yum.repos.d.bak#vim /etc/yum.conf[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
# PUT YOUR REPOS HERE OR IN separate files named file.repo 這兩行注釋可能會報錯,到時候刪除即可
# in /etc/yum.repos.d
#cd /etc/yum.repos.d
#rm -rf *
#vim CentOS-Base.repo
[base]name=centos-5 - Basebaseurl=http://centos.ustc.edu.cn/centos/5/os/i386/# the other site: http://centos.candishosting.com.cn/centos/5/os/i386/# you can find more site in: http://www.centos.org/modules/tinycontent/index.php?id=13enabled=1gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#released updates[update]name=CentOS-5 - Updatesbaseurl=http://mirror.centos.org/centos/5/updates/i386/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-5 - Addonsbaseurl=http://mirror.centos.org/centos/5/addons/$basearch/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-5 - Extrasbaseurl=http://mirror.centos.org/centos/5/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4#additional packages that extend functionality of existing packages[centosplus]name=CentOS-5 - Plusbaseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-5 - Contribbaseurl=http://mirror.centos.org/centos/5/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#packages in testing[testing]name=CentOS-5 - Testingbaseurl=http://mirror.centos.org/centos/5/testing/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
###################################################################################################
新聞熱點
疑難解答