centos下yum安装lamp
来源:互联网 发布:淘宝电玩巴士怎么样 编辑:程序博客网 时间:2024/04/30 07:01
CentOS下yum安装LAMP
1. 用yum安装Apache,Mysql,PHP.
1.1安装Apache
yum install httpd httpd-devel
安装完成后,用/etc/init.d/httpd start 启动apache
设为开机启动:chkconfig httpd on
1.2 安装mysql
1.2.1 yum install mysql mysql-server mysql-devel
同样,完成后,用/etc/init.d/mysqld start 启动mysql
1.2.2 设置mysql密码
mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
1.2.3 允许远程登录
mysql -u root -p
Enter Password: <your new password>
mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
完成后就能用mysql-front远程管理mysql了。
1.2.4 设为开机启动
chkconfig mysqld on
2. 安装php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
3. 测试一下
3.1在/var/www/html/新建个test.php文件,将以下内容写入,然后保存。
<?
phpinfo();
?>
3.2 防火墙配置
a.添加.允许访问端口{21: ftp, 80: http}.
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
3.3然后在客户端浏览器里打开http://serverip/test.php,若能成功显示,则表示安装成功。
至此,安装完毕。感慨,yum真是太好用了。
CentOS 打开防火墙80端口
注意:有时安装好可能无法访问,需要打开80端口
很大的原因是防火墙:
通过/etc/init.d/iptables status命令查询是否有打开80端口,如果没有可通过两种方式处理:
1.修改vi /etc/sysconfig/iptables命令添加使防火墙开放80端口
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
2.关闭防火墙
/etc/init.d/iptables stop
#start 开启
#restart 重启
永久性关闭防火墙chkconfig --level 35 iptables off
- CentOS下yum安装LAMP
- CentOS下yum安装lamp
- CentOS下yum安装LAMP
- CentOS下yum安装LAMP
- centos下yum安装lamp
- centos下 yum 安装 lamp
- CentOS下yum安装LAMP
- CentOS下yum安装LAMP
- centos下yum安装lamp
- centos下yum安装lamp
- [转载]CentOS下yum安装LAMP
- centos下yum快速安装lamp环境
- Centos下yum安装LAMP环境
- CentOS yum lamp安装
- Centos yum安装LAMP环境
- centos yum安装lamp环境
- Centos yum安装LAMP环境
- CentOS环境下yum安装LAMP(Linux+Apache+Mysql+php)
- 第二周 项目三 体验复杂度
- Leetcode: Strobogrammatic Number
- build-essential作用
- 项目2 - 程序的多文件组织
- 依赖管理
- centos下yum安装lamp
- *第二周*数据结构实践项目二【多文件系统】
- 静态链接库LIB和动态链接库DLL的区别
- Hello JSP!——request对象
- Understanding Explain Plan
- 聊聊我的高效编程之路
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- OGRE的实例框架相比FactoryMethod更像Bridge模式(含工厂模式)
- 第二周项目1-C++语言中函数参数传递的三种方式