linux下搭建lamp环境

1.安装apache

查看是否已经安装

rpm -qa | grep httpd

安装命令

yum -y install httpd

启动apache
service httpd start
停止服务apache
service httpd stop
重新启动apache
service httpd restart

rpm -qi httpd
查看软件安装版本信息

启动后输入ip即可打开

如果弹出错误Could not reliably determine the server's fully qualified domain name, using aaa for ServerName,或者访问拒绝

修改配置文件并重启

ServerName localhost:80

如果还是无法访问,可能是防火墙的问题。修改

vim /etc/sysconfig/iptables

找开80端口

 

其他命令:rpm -qa
列出所有被安装的rpm package

free
查看内存使用

ps -aux | sort -k4nr | head -10
进看进程及内存使用

ps aux | grep httpd
查看具体进程运行情况

 

2.上传首页文件。接下来安装php

yum -y install php php-mysql php-devel

完成后,可以正常运行php文件

3.安装mysql

yum -y install mysql mysql-server mysql-devel

root密码默认为空,输入下面修改

mysqladmin -u root -p password "123456"

4.上传phpmyadmin

tar zxvf phpMyAdmin-4.0.10.19-all-languages.tar.gz

5.设置开机启动

先查询apache和mysql服务是否存在,不存在则需要手动添加。
chkconfig --list

添加apache服务项命令:
chkconfig --add httpd
chkconfig --level 2345 httpd on

添加mysql服务项命令:
chkconfig --add mysqld
chkconfig --level 2345 mysqld on

添加vsftpd服务项命令:
chkconfig --add vsftpd
chkconfig --level 2345 vsftpd on

posted @ 2017-03-03 09:04  帽子戏法  阅读(247)  评论(0编辑  收藏  举报
全部 html css js Linux php MySQL seo web git other 联系 管理