CentOS LAMP安装与配置

环境:Ubuntu 11.04 desktop  Virtualbox4.0 CetnOS 5.5
以前在Ubuntu上安装过LAMP,一直没在CentOS上装过,为过这两个好像安装都一样,很方便。

第一步:安装apache mysql php
#yum install httpd httpd-devel mysql mysql-server mysql-devel php -y
//安装apacher服务器、apacher所需的库和包含文件、MySQL服务器、MySQL所需的库和包含文件、PHP

系统提示:
Installing
httpd-devel、mysql-server、mysql、mysql-devel、php
installing for dependencies:
apr-devel、apr-util-devel、cyrus-sasl-devl、db4-devel、e2fsprogs-devel、expat-devel、gcc、glibc-debel、glibc-headers、kernel-headers、keyutils-libs-devel、 krb5-devel、libselinux-devel、libsepol-devel、openldap-devel、openssl-devel、perl-DBD-MySQL、perl-DBI、php-cli、php-common、zlib-devel、

第二步:配置MySQL
创建mysql启动链接
chkconfig --levels 235 mysqld on                 //这样mysql会随着系统启动而启动


启动mysql
#etc/init.d/mysqld start

给root设置密码:
# mysql_secure_installation

系统提示:
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):   (一般刚装上mysql,root没有密码,在此直接Enter)

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y

New password: 12345678    //设定新密码

Re-enter new password:12345678   //再次确认密码

之后一路Enter就可以了

第三步:测试apache和php

创建httpd启动链接
chkconfig --levels 235 httpd on

启动apache

/etc/init.d/httpd start

apache测试:在浏览器里输入服务器IP,打开后看到apache那经典的页面,OK!apache正常运行了(如开了防火墙,不要忘记在防火墙放行www)。

PHP测试:创建个php.info
vim /var/www/html/info.php

<?
phpinfo();  
?>

然后在浏览器里输入应该能看到测试页面

第四步:让PHP支持mysql
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc  php-mbstring

系统提示:(安装以下软件包)
Installed:
  php-gd.i386 0:5.1.6-27.el5_5.3               php-imap.i386 0:5.1.6-27.el5_5.3          php-ldap.i386 0:5.1.6-27.el5_5.3         
  php-mbstring.i386 0:5.1.6-27.el5_5.3         php-mysql.i386 0:5.1.6-27.el5_5.3         php-odbc.i386 0:5.1.6-27.el5_5.3         
  php-pear.noarch 1:1.4.9-6.el5                php-xml.i386 0:5.1.6-27.el5_5.3           php-xmlrpc.i386 0:5.1.6-27.el5_5.3 

安装好后再重启httpd
#/etc/init.d/httpd restart

再在浏览器里输入应能看到mysql的模块

第五步:安装phpmyadmin
在centos里phpmyadmin无法用yum install来安装,先要加入
wget

在这一步,我的服务器就不行了,因为我这儿是要通过ISA的代理连接,到这儿就报错HTTP request sent. awaitiing response……ERROR 504: Proxy Timeout ( \350\277\236\346\216\245\350\266\205\346\227\266\343\200\202 \346\234\211\345\205\263\346\255\244\344\272\213\344\273\266\347\232\204\346\233\264\345\244\232\344\277\241\346\201\257\357\274\214\350\257\267\345\217\202\351\230\205 ISA \346\234\215\345\212\241\345\231\250\345\270\256\345\212\251\346\226\207\344\273\266\343\200\202 )

没办法只好在本地下了一个然后传到服务器上后安装。
rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
然后再
yum install phpmyadmin

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://127.0.0.1/wyyxsp.html