1 安装 Apache
yum install httpd
service httpd restart // 重启
chkconfig httpd on // 开机自动运行
访问ip 或者 curl http://localhost 查看是否生效
如果这时候发现无法访问公网ip, 云服务器后台的安全组。
1 、添加一条 入方向的规则
允许 自定义 TCP
80/80 地址段访问
0.0.0.0/0
apahce
1 2017-06-27 11:31:46
mysql 3306 设置同理
2、无法连接。有密钥 ,可以在密钥管理中删除密钥,也可以使用密钥连接。建议删除
2 安装 php 7
//更新源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
// yum 安装
yum install php70w
如果发生Loaded plugins: fastestmirror Determining fastest mirrors 的错误问题
其大概意思是fastestmirror不能使用,fastestmirror是yum的一个加速插件
修改配置文件
vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=0 //把1改为0
verbose=0
socket_timeout=3
hostfilepath=/var/cache/yum/timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
vi /etc/yum.conf
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1 #将plugins的值修改为0
installonly_limit=5
service httpd restart // 重启apache
<?php phpinfo(); ?>
vi /var/www/html/index.php访问ip 查看phpinfo
3 安装mysql5.7
// 更新源
rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
//安装
yum install mysql-community-server
//启动
service mysqld start
// 开机启动
systemctl start mysqld.service
Mysql5.7默认安装之后root是有密码的
为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log。
只有启动过一次mysql才可以查看临时密码
grep ‘temporary password’ /var/log/mysqld.log
[Note] A temporary password is generated for root@localhost: y#tpUjEHy6Bs
//临时密码就是 localhost: 之后的
3.1 修改密码
mysql -uroot -p // 使用默认密码登录 必须立刻修改密码 不然会报错
You must reset your password using ALTER USER statement before executing this statement.
//修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';
3.2 安装扩展
yum install php70w-mysql
service httpd restart // 重启生效