LAMP compilation log, LAMP compilation log,

Source: Internet
Author: User
Tags dovecot

LAMP compilation log, LAMP compilation log,

On CentOS5.2, the LAMP program was compiled and tested two years ago.

 

### Do not enable automatic line breaks in Notepad; otherwise, some commands cannot run normally.
### Test the source file to the/src/directory and then enter/src
//////////////////////////////////////// /////////////////////////////

Cd/src
Tar zxvf autoconf-2.61.tar.gz
Tar zxvf libxml2-2.6.30.tar.gz
Tar zxvf freetype-2.3.5.tar.gz
Tar zxvf mysql-5.1.67.tar.gz
Tar zxvf gd-2.0.35.tar.gz
Tar zxvf httpd-2.2.9.tar.gz
Tar zxvf php-5.2.6.tar.gz
Tar zxvf restart src.v6b.tar.gz
Tar zxvf phpMyAdmin-3.0.0-rc1-all-languages.tar.gz
Tar zxvf libmcrypt-2.5.8.tar.gz
Tar zxvf ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gz
Tar zxvf libpng-1.2.31.tar.gz
Tar zxvf zlib-1.2.3.tar.gz
Tar zxvf ncurses-5.6.tar.gz
Rm-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
./Configure
Make & make install

Cd/src/libpng-1.2.31
./Configure -- prefix =/usr/local/libpng
Make & make install


Cd/src/jpeg-6b
Mkdir/usr/local/limit 6
Mkdir/usr/local/partition 6/bin
Mkdir/usr/local/IPv6/lib
Mkdir/usr/local/users 6/include
Mkdir-p/usr/local/users 6/man/man1
./Configure -- prefix =/usr/local/configure 6/-- enable-shared -- enable-static
Make & make install


Cd/src/freetype-2.3.5
./Configure -- prefix =/usr/local/freetype
Make & make install


Cd/src/autoconf-2.61
./Configure
Make & make install


Cd/src/gd-2.0.35
. /Configure -- prefix =/usr/local/gd2/-- with-zlib =/usr/local/zlib/-- with-jpeg =/usr/local/defaults 6/-- with-png =/usr/local/libpng/-- with-freetype =/usr/local/freetype/


Vi gd_png.c

 

 

//////////////////////////////////////// //////////////////////////////////////// ///////////////////////////
###
### (The above make is not successful. After modifying gd_png.c, do it again)
### Vi gd_png.c
### Modify # include "png. h" to # include "/usr/local/libpng/include/png. h. The system cannot be found by default.
### Note that the next line may fail !! Check the installation directory. If not, perform another./configure operation.
###
//////////////////////////////////////// //////////////////////////////////////// ////////////////////////////


. /Configure -- prefix =/usr/local/gd2/-- with-zlib =/usr/local/zlib/-- with-jpeg =/usr/local/defaults 6/-- 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-defined ded-apr -- enable-so -- enable-deflate = shared -- enable-expires = shared -- enable-rewrite = shared -- enable-static-support
Make & make install


Cd/src/ncurses-5.6
./Configure
Make & make install

Cd/src/mysql-5.1.67
Groupadd mysql
Useradd-g mysql
./Configure -- prefix =/usr/local/mysql -- with-extra-charsets = all
Make & make install
Cp/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/versions 6/-- 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. conf

 


//////////////////////////////////////// //////////////////////////////////////// ///////////
###
### Vi/etc/httpd. conf
###
### Add
### Addtype application/x-httpd-php. php
### Make it support files suffixed with php
###
### On the <Directory "/usr/local/apache2/htdocs"> node
### Set Options Indexes FollowSymLinks
### Change to Options-Indexes FollowSymLinks
### Add the minus sign from Indexs. In this way, you can disable directory browsing.
### Under it
### Set AllowOverride None
### Change to AllowOverride All
### Pseudo-static
###
### On the <IfModule dir_module> node
### Set DirectoryIndex index.html
### Change to DirectoryIndex index.html index. php
### Add index. php. The default index page is added.
###
###
//////////////////////////////////////// //////////////////////////////////////// ////////////

Cd/src/ZendOptimizer-3.2.6-linux-glibc21-i386
./Install. sh

//////////////////////////////////////// ////////////////////
###
### Enter the php. ini directory
###/Usr/local/php/etc/
###
//////////////////////////////////////// /////////////////////

Cp-a/src/phpMyAdmin-3.0.0-rc1-all-languages/usr/local/apache2/htdocs/phpmyadmin
Cd/usr/local/apache2/htdocs/phpmyadmin/
Cp config. sample. inc. php config. inc. php
Vi config. inc. php

//////////////////////////////////////// /////////////////////
###
### Add a key
### $ Cfg ['blowfish _ secret'] = ""
### Add a key here
###
//////////////////////////////////////// //////////////////////


Vi/etc/init. d/mysql


//////////////////////////////////////// ///////////////////
###
Content to be pasted


#! /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

###
### Grant permissions after saving a disk
###

 

Chmod 777/etc/init. d/mysql

Vi/etc/init. d/apache

 


//////////////////////////////////////// ///
Content to be pasted

#! /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 restart
Esac


//////////////////////////////////////// //
After saving the disk, grant the permission
//////////////////////////////////////// //////
Chmod 777/etc/init. d/apache

Chkconfig -- add mysql
Chkconfig -- add apache

 

 

//////////////////////////////////////// ///////

Follow-up questions
Mysql Security
Mysql Character Set
Samba win sharing

//////////////////////////////////////// ///////



1. Open the mysql Console
/Usr/local/mysql/bin/mysql

A. Set security

Mysql> select * from mysql. user \ G
Mysql> delete from mysql. user where host = 'localhost' and user = '';
Mysql> flush privileges;
Mysql> set password for 'root' @ 'localhost' = PASSWORD ('abc123 ');

B. Set character sets

Before modification, You can see four latin1 in View> status;

Vi/etc/my. cnf

In the [client] Section
Join
Default-character-set = utf8
On the [mysqld] Node
Join
Character-set-server = utf8
Collation-server = utf8_general_ci


Enter

/Usr/local/mysql/bin/mysql-u root-p
Enter the password and log on to the background.
Mysql> status;
View, corresponding to four utf8

 

Shell monitoring

######################################## ###############################
Shell script Monitoring Alarm
######################################## ###############################

Service sendmail stop
Chkconfig sendmail off

# Check
Pstree | grep sendmail

### Install postfix

Yum-y install postfix *

### Install dovecot

Yum-y install dovecot *

 

### Configure postfix/etc/postfix/
Cd/etc/postfix

Vi main. cf

# Change myhostname = host. domain. tld
# Server host name
Myhostname = mail.g.cn
# Server Domain Name
Mydomian = g.cn

# Suffix of the sender's @
Myorigin = $ myhostname
Myorigin = $ mydomain

### Listener interface (comment out the bottom one)
Inet_interfaces = all
# Inet_interfaces = localhost

### Recipient's suffix
Mydestination = $ myhostname, $ mydomain

### Network segment of the server
Mynetworks = 192.168.7.0/24,127.0 .0.0/8

### Allow post office forwarding
Relay_domains = $ mydestination

### Start postfix
Service postfix start
Pstree | grep master
Netstat-tunpl | grep 25
Chkconfig postfix on

### Set the default Mail forwarding server as postfix by sendmail
Alternatives -- config mta
During the upgrade, enter the number and press enter to set the default program.


### Configure dovecot,/etc/dovecot. conf
Vi/etc/dovecot. conf
# Remove comments from this line
Protocols = imap imaps pop3 pop3s

Service dovecot restart
Chkconfig mongocot on
Netstat-tunpl | grep 110


### Write a script.
### Alarms disabled by apache


#! /Bin/bash
# Apache. sh

Nc-w2 localhost 80
If [$? -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 script

#! /Bin/bash
# Mysql. sh

Nc-w2 localhost3306
If [$? -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

 

#### Disk SCRIPT> 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

 

#### Test
Dd if =/dev/zero of1_test.txt bs = 1 M count = 1000

### Add a scheduled task
### Run the command once every 5 minutes,

Crontab-e


*/5 */disk. sh
*/5 */mysql. sh
*/5 */apache. sh


Crontab-l
View scheduled tasks


######################################## ######################################## #############

Clear the root mailbox

######################################## ######################################## #############

If all are cleared, cp/dev/nulll/var/spool/mail/root is available.

To delete a letter, run the command

& D [letter-number 〕

For example, to delete the second message, use the following method & d 2

To delete the first to third emails, run the following command:

To kill all emails, use & d *

Perform root forwarding because root cannot log on remotely and receive emails. Therefore, an alias is created. Like xuyong@tralinhotel.cn

Edit aliases in vi/etc/aliases catalog and add the following line to the end of the text

Root: xuyong@tralinhotel.cn

Newaliases restore aliasesdb

Echo test | mail root users send a test email to root


######################################## ######################################## #############\

Changed the source, yum

######################################## ######################################## #############


Modify REDHAT yum source to CENTOS
1. Back up the original YUM Source
# 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 comments of these two lines may report an error. Delete the comments at that time.

# In/etc/yum. repos. d

 


# Cd/etc/yum. repos. d

# Rm-rf *

# Vim CentOS-Base.repo.

[Base]
Centos-5-Base
Base url = 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 = 13
Enabled = 1
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
# Released updates
[Update]
CentOS-5-Updates
Base url = http://mirror.centos.org/centos/5/updates/i386/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
CentOS-5-Addons
Baseurl = http://developer.centos.org/centos/5/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = CentOS-5-Extras
Baseurl = http://developer.centos.org/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
# Additional packages that extend functionality of existing packages
[Centosplus]
CentOS-5-Plus
Baseurl = http://developer.centos.org/centos/5/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
# Contrib-packages by Centos Users
[Contrib]
Name = CentOS-5-Contrib
Baseurl = http://developer.centos.org/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
# Packages in testing
[Testing]
CentOS-5-Testing
Baseurl = http://developer.centos.org/centos/5/testing/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5


######################################## ######################################## ###################

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.