Linux下Lamp(rpm包)搭建+网页管理mysql
Lamp(rpm)安装:
一:编辑本地yum用于安装软件包:
[root@localhost ~]# cd /mnt/cdrom/
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/
[root@localhost ~]# cd /mnt/cdrom/Server/
[root@localhost Server]# vim /etc/yum.repos.d/rhel-debuginfo.repo #编辑本地yum
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715937Lhmh.gif"></a>
二:安装http服务器:
[root@localhost Server]# yum install httpd -y #使用yum安装http服务,-y表示取消交互
[root@localhost Server]# service httpd start #启动http
[root@localhost Server]# chkconfig httpd on #开机自动启动http
三:安装mysql数据库:
[root@localhost Server]# yum list all |grep mysql #查看与mysql相关的安装包
[root@localhost Server]# yum install mysql -y #安装mysql工具包
[root@localhost Server]# yum install mysql-server -y #安装mysql-server服务器
[root@localhost Server]# service mysqld start #启动mysql服务
[root@localhost Server]# chkconfig mysqld on #开机自动启动mysql
[root@localhost Server]# netstat -tupln |less #分页查看端口
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715938c5IR.gif"></a>
[root@localhost Server]# mysqladmin -u root -p password '123' #为数据库创建口令
[root@localhost Server]# mysql -u root -p #使用口令登录数据库
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715942CsjL.gif"></a>
四:安装php:
[root@localhost Server]# yum list all |grep php #查看与php相关的安装包
[root@localhost Server]# yum install php -y #安装php主程序
[root@localhost Server]# yum install php-mysql -y #安装php与mysql的连接包
五:查看http调用php模块:
[root@localhost Server]# cd /etc/httpd/conf.d/ #切换到该目录中查看http调用http模块
[root@localhost conf.d]# cat php.conf
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715943Umbf.gif"></a>
六:测试http能否调用php:
[root@localhost conf.d]# cd /var/www/html/
[root@localhost html]# vim index.php #创建该文件,测试http能否调用php
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715944LSF4.gif"></a>
[root@localhost html]# service httpd restart
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715944wHvd.gif"></a>
七:测试php能否调用mysql:
[root@localhost html]# vim index.php #再次编辑该文件,查看php能否成功调用mysql
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715944jXTV.gif"></a>
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715945QZxs.gif"></a>
八:安装phpmyadmin,通过php网页形式来管理mysql
[root@localhost ~]# unzip phpMyAdmin-2.11.10.1-all-languages.zip #解压
[root@localhost ~]# mv phpMyAdmin-2.11.10.1-all-languages /var/www/html/phpmymdmin
#将该文件移动到/var/www/html中,并改名为phpMyAdmin
[root@localhost ~]# cd /var/www/html/
[root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php
[root@localhost phpmyadmin]# vim config.inc.php #修改该文件如图:
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715946ltZw.gif"></a>
[root@localhost phpmyadmin]# service httpd restart
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715948uK9g.gif"></a>
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_1347715950oN6b.gif"></a>
九:根据网页提示安装php-mbstring
[root@localhost ~]# yum list all |grep php
[root@localhost ~]# yum install php-mbstring -y #安装mbstring
[root@localhost ~]# yum localinstall libmcrypt-2.5.7-5.el5.i386.rpm
php-mcrypt-5.1.6-5.el5.i386.rpm --nogpgcheck #使用localinstall安装光盘中手动导入的rpm包,这些软件包无法获取公钥,使用--nogpgcheck,取消签名检测
<a href="http://5493845.blog.51cto.com/attachment/201209/15/5493845_13477159513HgI.gif"></a>
安装php-mbstring及mcrypt后,没有了错误提示。这样就可以通过网页的形式管理mysql
本文转自 liuyatao666 51CTO博客,原文链接:http://blog.51cto.com/5503845/992166,如需转载请自行联系原作者