CentOS6.5 PHP基础环境搭建 [个人整理-亲测可用]

**
* CentOS6.5 搭建基础PHP环境(yum安装)
* http://www.aiplaypc.com/160.html
**
 
#安装需要的包,有依赖关系,自动帮你解决
yum install httpd mysql mysql-server php php-gd php-mbstring php-mysql
 
#启动httpd
service httpd start
#设为开机启动
chkconfig httpd on
 
#启动mysqld
service mysqld start
#设为开机启动
chkconfig mysqld on
 
#在根目录下创建一个测试文件,写个phpinfo函数 <?php phpinfo(); ?>
vi /var/www/html/phpinfo.php
 
在服务器端打开浏览器,输入http://ip/phpinfo.php,就可以看到phpinfo的输出页面了(注意iptables有没有让80端口通过)
 
 
 
 
**
* Centos 开放80端口
* http://www.cnblogs.com/cnjava/p/3311950.html
**
 
开启80和22端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
 
然后保存:
/etc/rc.d/init.d/iptables save
 
再查看防火墙状态
/etc/init.d/iptables status
 
 
 
**
* CentOS 开启和关闭防火墙
* http://www.myhack58.com/Article/48/66/2013/37314.htm**
临时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
查看防火墙状态:/etc/init.d/iptables status
 
 
 
 
 
**
* centos mysql 安装及配置
* http://jingyan.baidu.com/article/fec7a1e5f8d3201190b4e782.html
**
 
安装Mysql
yum list mysql-server
 
先启动Mysql服务
service mysqld start
 
连接一下试一下
mysql
然后关闭连接
\q
 
设置Mysql开机启动
chkconfig mysqld on
 
 
开启3306端口并保存
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
 
连接mysql数据库
mysql
 
设置密码(这里设置为123456)
use mysql;
update user set password=password('123456') where user='root';
flush privileges;
 
设置Mysql远程访问
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
 
关闭连接
\q
 
重新启动服务就可以了
service mysqld restart
 
 
**
* CentOS Linux系统下更改Apache默认网站目录(记得更改目录权限)
* http://blog.sina.com.cn/s/blog_a7cf995a0101azak.html
**
 
 
 
 
**
* Centos 下搭建FTP服务器
* http://www.centoscn.com/CentosServer/ftp/2013/0730/816.html
* http://blog.csdn.net/hyholine/article/details/24579001
**
 
 
首先判断你服务器上是否安装了vsftpd
rpm -q vsftpd
 
安装vsftpd
yum -y install vsftpd
 
设置开机启动vsftpd ftp服务
chkconfig vsftpd on
 
启动vsftpd服务
service vsftpd start
 
配置防火墙
vi /etc/sysconfig/iptables
 
在REJECT行之前添加如下代码
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
 
保存和关闭文件,重启防火墙
service iptables start
 
编辑vsftpd的主配置文件
vi /etc/vsftpd/vsftpd.conf
 
把anonymous_enable改为NO 默认是YES(改为NO 就是禁止匿名用户登录,去掉前面的#)
 
不可以让ftp用户跳出自己的家目录,否则太危险了,需要做限制
去掉choot_local_user=YES前面的注释
 
创建ftp用户
useradd -s /sbin/nologin -d /var/www/html admin
(admin这个用户只能连接ftp无法登录系统,默认家目录是在var/www/html 文件夹下面)
 
给admin设置密码
passwd admin
 
然后给家目录修改权限,否则你无法上传文件
chmod o+w /var/www/html/
 
修改selinux
setenforce 0
 
重启vsftpd服务
service vsftpd restart
 
停止vsftpd: service vsftpd stop
重启vsftpd: service vsftpd restart
 
 
 
 
**
* CentOS添加和删除用户
* http://www.2cto.com/os/201404/290105.html
**
 
添加用户 test:
adduser test
 
修改test密码:
passwd test
 
删除用户test:
userdel test
 
删除用户以及用户目录:
userdel -f test
 

转载于:https://www.cnblogs.com/yanghuaqiang/p/5852789.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值