CentOS LAMP安装与配置
环境:Ubuntu11.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();
?>
然后在浏览器里输入http://IP/info.php应该能看到测试页面
第四步:让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
相关新闻>>
- 发表评论
-
- 最新评论 更多>>