CentOS 查看操作系统版本
[root@oa ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。
基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
1、更新一下yum
[root@oa ~]# yum -y update
2、用yum安装Apache,Mysql,PHP
安装Apache:
[root@oa ~]# yum install httpd httpd-devel
安装完成后, 启动apache
[root@oa ~]# /etc/init.d/httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for oa.aioute.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
设为开机启动
[root@oa ~]# chkconfig httpd on
安装mysql:
[root@oa ~]# yum install mysql mysql-server mysql-devel
启动mysql
[root@oa ~]# /etc/init.d/mysqld start
参考:[CentOS 0010] CentOS 配置mysql允许远程登录
设置mysql密码,并开启远程权限:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> EXIT
允许3306端口:
[root@oa ~]# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
[root@oa ~]# iptables -L -n
安装php:
yum install php php-devel
重启apache使php生效:
/etc/init.d/httpd restart
[root@oa ~]# yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
重新启动php:
[root@oa ~]# /etc/init.d/httpd restart
Starting httpd:
3、允许端口访问
[root@oa ~]# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
[root@oa ~]# iptables -L -n
配置文档参考 CentOS下安装配置LAMP(Linux+Apache+MySQL+PHP)
文件夹权限 CentOS的文件权限与目录配置