CentOS 5.5使用yum安装LAMP环境(sohu源)

CentOS 5.5默认的是163的源,据说sohu的源很好用,今天小试了下。

 1、修改yum配置文件,更改为sohu源

# cd /etc/yum.repos.d/ 
#
cp CentOS-Base.repo CentOS-Base.repo.bak

清空CentOS-Base.repo文件内容,替换为以下内容:

# CentOS-Base.repo 
#
# This file uses a
new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use
this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist
= does not work for you, as a fall back you can try the
# remarked
out baseurl= line instead.
#
#
[
base]
name
=CentOS-$releasever - Base
baseurl
=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey
=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name
=CentOS-$releasever - Updates
baseurl
=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey
=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name
=CentOS-$releasever - Addons
baseurl
=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey
=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name
=CentOS-$releasever - Extras
baseurl
=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey
=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name
=CentOS-$releasever - Plus
baseurl
=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled
=0
gpgkey
=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

更新源

# yum -y update

2、使用yum命令安装apache、mysql、PHP环境

#yum -y install httpd php mysql mysql-server php-mysql
#
这里只装了最基础的,其他扩展没装

3、设定服务启动与自启动

# chkconfig httpd on
#
chkconfig --add mysqld
#
chkconfig mysqld on

# service httpd start
#
service mysqld start

4、防火墙设置

a.添加.允许访问端口{21: ftp, 80: http}. 
# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
#
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
b.或者关闭防火墙(不推荐).
# service iptables stop
c.重置加载防火墙
# service iptables restart

5、修改mysql的密码

#mysqladmin -u root password 'root'

其他的配置,童鞋们自己搞吧

 

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

安装日志:

 

[jianbao@localhost ~]$ yum install -y httpd php mysql mysql-server php-mysql php-devel
Loaded plugins: fastestmirror
You need to be root to perform this command.
[jianbao@localhost ~]$ su -
口令:
[root@localhost ~]# yum install -y httpd php mysql mysql-server php-mysql php-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386  0: 2.2. 3- 53.el5.centos. 3 set to be updated
---> Package mysql.i386  0: 5.0. 95- 1.el5_7. 1 set to be updated
--> Processing Dependency: perl(DBI)  for package: mysql
---> Package mysql-server.i386  0: 5.0. 95- 1.el5_7. 1 set to be updated
--> Processing Dependency: perl-DBD-MySQL  for package: mysql-server
---> Package php.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
--> Processing Dependency: php-cli =  5.1. 6- 27.el5_7. 5  for package: php
--> Processing Dependency: php-common =  5.1. 6- 27.el5_7. 5  for package: php
---> Package php-devel.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
--> Processing Dependency: autoconf  for package: php-devel
--> Processing Dependency: automake  for package: php-devel
---> Package php-mysql.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
--> Processing Dependency: php-pdo  for package: php-mysql
--> Running transaction check
---> Package autoconf.noarch  0: 2.59- 12 set to be updated
--> Processing Dependency: imake  for package: autoconf
---> Package automake.noarch  0: 1.9. 6- 2.3.el5 set to be updated
---> Package perl-DBD-MySQL.i386  0: 3.0007- 2.el5 set to be updated
---> Package perl-DBI.i386  0: 1.52- 2.el5 set to be updated
---> Package php-cli.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
---> Package php-common.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
---> Package php-pdo.i386  0: 5.1. 6- 27.el5_7. 5 set to be updated
--> Running transaction check
---> Package imake.i386  0: 1.0. 2- 3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch        Version                     Repository    Size
================================================================================
Installing:
 mysql               i386         5.0. 95- 1.el5_7. 1            updates       4.9 M
 mysql-server        i386         5.0. 95- 1.el5_7. 1            updates       9.8 M
 php                 i386         5.1. 6- 27.el5_7. 5            updates       2.3 M
 php-devel           i386         5.1. 6- 27.el5_7. 5            updates       504 k
 php-mysql           i386         5.1. 6- 27.el5_7. 5            updates        86 k
Updating:
 httpd               i386         2.2. 3- 53.el5.centos. 3       updates       1.2 M
Installing  for dependencies:
 autoconf            noarch       2.59- 12                     base          647 k
 automake            noarch       1.9. 6- 2.3.el5               base          476 k
 imake               i386         1.0. 2- 3                     base          319 k
 perl-DBD-MySQL      i386         3.0007- 2.el5                base          148 k
 perl-DBI            i386         1.52- 2.el5                  base          600 k
 php-cli             i386         5.1. 6- 27.el5_7. 5            updates       2.1 M
 php-common          i386         5.1. 6- 27.el5_7. 5            updates       153 k
 php-pdo             i386         5.1. 6- 27.el5_7. 5            updates        65 k

Transaction Summary
================================================================================
Install       13 Package(s)
Upgrade        1 Package(s)

Total download size:  23 M
Downloading Packages:
( 1/ 14): php-pdo- 5.1. 6- 27.el5_7. 5.i386.rpm                |   65 kB      00: 00     
( 2/ 14): php-mysql- 5.1. 6- 27.el5_7. 5.i386.rpm              |   86 kB      00: 00     
( 3/ 14): perl-DBD-MySQL- 3.0007- 2.el5.i386.rpm             |  148 kB      00: 00     
( 4/ 14): php-common- 5.1. 6- 27.el5_7. 5.i386.rpm             |  153 kB      00: 00     
( 5/ 14): imake- 1.0. 2- 3.i386.rpm                           |  319 kB      00: 01     
( 6/ 14): automake- 1.9. 6- 2.3.el5.noarch.rpm                |  476 kB      00: 02     
( 7/ 14): php-devel- 5.1. 6- 27.el5_7. 5.i386.rpm              |  504 kB      00: 02     
( 8/ 14): perl-DBI- 1.52- 2.el5.i386.rpm                     |  600 kB      00: 02     
( 9/ 14): autoconf- 2.59- 12.noarch.rpm                      |  647 kB      00: 02     
( 10/ 14): httpd- 2.2. 3- 53.el5.centos. 3.i386.rpm            |  1.2 MB      00: 05     
( 11/ 14): php-cli- 5.1. 6- 27.el5_7. 5.i386.rpm               |  2.1 MB      00: 07     
( 12/ 14): php- 5.1. 6- 27.el5_7. 5.i386.rpm                   |  2.3 MB      00: 08     
( 13/ 14): mysql- 5.0. 95- 1.el5_7. 1.i386.rpm                 |  4.9 MB      00: 18     
( 14/ 14): mysql-server- 5.0. 95- 1.el5_7. 1.i386.rpm          |  9.8 MB      00: 39     
--------------------------------------------------------------------------------
Total                                            256 kB/s |   23 MB      01: 32     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-common                                               1/ 15 
  Installing     : perl-DBI                                                 2/ 15 
  Installing     : mysql                                                    3/ 15 
  Installing     : perl-DBD-MySQL                                           4/ 15 
  Installing     : php-pdo                                                  5/ 15 
  Installing     : php-cli                                                  6/ 15 
  Installing     : imake                                                    7/ 15 
  Updating       : httpd                                                    8/ 15 
  Installing     : php                                                      9/ 15 
  Installing     : php-mysql                                               10/ 15 
  Installing     : mysql-server                                            11/ 15 
  Installing     : autoconf                                                12/ 15 
  Installing     : automake                                                13/ 15 
  Installing     : php-devel                                               14/ 15 
  Cleanup        : httpd                                                   15/ 15 

Installed:
  mysql.i386  0: 5.0. 95- 1.el5_7. 1         mysql-server.i386  0: 5.0. 95- 1.el5_7. 1    
  php.i386  0: 5.1. 6- 27.el5_7. 5           php-devel.i386  0: 5.1. 6- 27.el5_7. 5       
  php-mysql.i386  0: 5.1. 6- 27.el5_7. 5    

Dependency Installed:
  autoconf.noarch  0: 2.59- 12              automake.noarch  0: 1.9. 6- 2.3.el5       
  imake.i386  0: 1.0. 2- 3                   perl-DBD-MySQL.i386  0: 3.0007- 2.el5    
  perl-DBI.i386  0: 1.52- 2.el5             php-cli.i386  0: 5.1. 6- 27.el5_7. 5       
  php-common.i386  0: 5.1. 6- 27.el5_7. 5     php-pdo.i386  0: 5.1. 6- 27.el5_7. 5       

Updated:
  httpd.i386  0: 2.2. 3- 53.el5.centos. 3                                            

Complete!
[root@localhost ~]#

 

 

[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# service httpd start
启动 httpd:                                               [确定]
[root@localhost ~]# service mysqld start
初始化 MySQL 数据库: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot  time you have to copy
support-files/mysql.server to the right place  for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password  ' new-password '
/usr/bin/mysqladmin -u root -h localhost.localdomain password  ' new-password '

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases  and anonymous user created by  default.  This is
strongly recommended  for production servers.

See the manual  for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http: // www.mysql.com
Support MySQL by buying support/licenses at http: // shop.mysql.com
                                                           [确定]
启动 MySQL:                                               [确定]
[root@localhost ~]#

 

 

 

 

你可能感兴趣的:(CentOS 5.5使用yum安装LAMP环境(sohu源))