yum php mysql5.5_CentOS 5.5使用yum来安装LAMP(php运行环境)

CentOS 5.5使用yum来安装LAMP(php运行环境)

更新时间:2010年09月10日 21:05:37   作者:

今天用yum方法搭建起了个LAMP环境,中间遇到了很多问题,经过google和各位前辈的帮助,终于将环境搭建起来,现在把完整的步骤记录下来,

1. 换源,sohu的相当好用。

1.1备份CentOS-Base.repo

cd /etc/yum.repos.d/

cp CentOS-Base.repo CentOS-Base.repo.bak

1.2替换源

用vi打开CentOS-Base.repo,并将内容清空,然后将下面的内容复制进去,并保存。

# CentOS-Base.repo

#

# This file uses a new mirrorlist system developed by Lance Davis for CentOS.

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client. You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-$releasever - Base

baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever - Addons

baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

1.3更新一下。

yum -y update

2. 用yum安装Apache,Mysql,PHP.

2.1安装Apache

yum install httpd httpd-devel

安装完成后,用/etc/init.d/httpd start 启动apache

设为开机启动:chkconfig httpd on

2.2 安装mysql

2.2.1 yum install mysql mysql-server mysql-devel

同样,完成后,用/etc/init.d/mysqld start 启动mysql

2.2.2 设置mysql密码

mysql>; USE mysql;

mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';

mysql>; FLUSH PRIVILEGES;

2.2.3 允许远程登录

mysql -u root -p

Enter Password:

mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

完成后就能用mysql-front远程管理mysql了。

2.2.4 设为开机启动

chkconfig mysqld on

3. 安装php

yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

/etc/init.d/httpd start

4. 测试一下

4.1在/var/www/html/新建个test.php文件,将以下内容写入,然后保存。

phpinfo();

?>

4.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

4.3然后在客户端浏览器里打开http://serverip/test.php,若能成功显示,则表示安装成功。

至此,安装完毕。感慨,yum真是太好用了。

相关文章

1a1b05c64693fbf380aa1344a7812747.png

80端口被占用导致Apache启动失败怎么解决,小编遇到很头疼的问题,下面为大家分享一篇关于80端口被占用导致Apache启动失败的文章,希望可以解决大家的问题2017-03-03

4f55910a645b073bc4fc65dc10dc14bd.png

这篇文章主要介绍了Linux 下载安装VSCode 使用编程输出当前时间,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2020-06-06

0ea3c7666119d5615e582f823fb3fad6.png

这篇文章主要介绍了详解Linux防火墙iptables禁IP与解封IP常用命令,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-03-03

4f96a78db829b1556ff16de21e013c7a.png

QQ服务器端口为:8000;客户端端口为:4000(开启第二个QQ时为4001,依次类推);均为UDP.MSN端口数较多:1863为登陆所需要的端口以及3000-4000等等2013-04-04

8cc1031babc6aff2319f1c6af8544aa0.png

这篇文章主要介绍了Ubuntu使用国内源出现Hash Sum mismatch错误的解决,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-04-04

0c932a99bb7b6f23c937db507070cc7b.png

下面小编就为大家带来一篇浅谈linux线程切换问题。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-01-01

cca732bf65a93ed2ec0ac80c638460fe.png

这篇文章主要介绍了浅谈ubuntu执行.sh文件几种方式区别,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2019-09-09

2d9f31f2af7b675a3d153d2b7f1035a7.png

本文主要是给出了Ubuntu下sublime中文无法输入的处理方案,非常的实用,遇到相同问题的小伙伴们可以参考下2014-11-11

b452cee8ec5cd9e58ab98eba17281e59.png

下面小编就为大家带来一篇Centos下编译Linux内核的具体实现方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧2016-12-12

f4838ec7e2d4da28e0b57d4e852dadd4.png

这篇文章主要介绍了Centos 7之Firewalld相关命令详细介绍的相关资料,需要的朋友可以参考下2017-02-02

最新评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值