新环境 只用CentOS 7

转载:先存着

坑点

1. nginx 内网能访问,外网无法访问
firewall-cmd --state #查看防火墙状态
firewall-cmd --permanent --add-port=80/tcp # 打开80端口
firewall-cmd --reload  #重启

系统不一样的命令

ECS使用的是 Linux CentOS 7 
重启服务不再通过 service  操作,而是通过 systemctl 操作。

查看:systemctl status xxx

启动:systemctl start xxx

重启:systemctl restart xxx

自启:systemctl enable xxx

安装命令是
yum install xxx 而不是 apt-get install xxx (其他linux会使用这个)

更改使用ssh密钥登录 重要

cd /root/.ssh
ssh-keygen -t rsa -b 4096 #一路回车
#如果没有authorized_keys
#touch authorized_keys

chmod 600 /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

下载
sz id_rsa 保存

关闭root用户使用密码登陆
修改 
vi /etc/ssh/sshd_config
PasswordAuthentication no

service sshd restart

宝塔相关 强烈推荐


#安装宝塔面板
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh -y
安装完成后
/etc/init.d/bt default #查看登录入口信息

# 自动挂载磁盘
yum install wget -y && wget -O auto_disk.sh http://download.bt.cn/tools/auto_disk.sh && bash auto_disk.sh

#bt fuck
下载/www/server/panel/class下的panelPlugin.py
在280行替换 return softList 注意缩进要和 return softList保持一致
#return softList
softList['pro'] = 1
for soft in softList['list']:
    soft['endtime'] = 1
return softList
最后重启宝塔
/etc/init.d/bt restart

插件市场安装需要指定php和mysql的版本
php 需要 7.0 mysql 5.7

进入后台后需要选择 禁ping

宝塔 nginx 配置文件目录 /www/server/panel/vhost/nginx/

挂载硬盘后把bt-backup文件夹移走或删了 占用空间太大了

新环境需要安装的

  1. 宝塔
  2. java
  3. 待续
安装apache 不需要
apache在centos7中是Apache HTTP server,所以想安装apache其实是要安装httpd
yum install httpd
systemctl enable httpd.service
systemctl start httpd.service
#配置文件目录
/etc/httpd/conf/httpd.conf
# 这里有一个妖蛾子,此时如果更改端口号会导致重启httpd不了
解决办法
yum provides semanage #安装semanage命令
yum -y install policycoreutils-python.x86_64
semanage port -a -t http_port_t -p tcp 更改的端口号
最后
systemctl start httpd.service #完成安装

mysql修改远程访问权限 至少需要5.7

先查看是否启用防火墙
systemctl status firewalld
如果是关闭状态则需要开启
systemctl start firewalld # stop 关闭
添加端口
firewall-cmd --permanent --zone=public --add-port=3306/tcp
success
重启
firewall-cmd --reload
success

mysql -u root -p
密码
mysql> use mysql;
Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
exit; #退出

注意 最后的;不能少

安装mongodb

vi /etc/yum.repos.d/mongodb-org.repo
[mongodb-org]
name=MongoDB Repository
baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1

yum install -y mongodb-org
vi /etc/mongod.conf
注释 bindIp: 127.0.0.1 或改 0.0.0.0

systemctl start mongod
systemctl enable mongod

安装php

只安7.0
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 install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel

安装必要的拓展库 更多见 https://www.cnblogs.com/yanqingxu/p/9248849.html
yum install php70w-common
yum install php70w-gd
yum install php70w-pdo_mysql
yum install php70w-mbstring

php -v #查看版本
php -m #查看拓展
配置文件php.ini路径 /etc/php.ini

系统软件

docker安装
yum install docker-io –y
systemctl start docker
#查看docker进程
docker info
#镜像管理
docker pull registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5
#重命名为 aliweb:v1
docker tag registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5:latest 
docker rmi –f registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5
# docker目录设置
cd /usr/libexec/docker
export PATH=$PATH:

docker安装

nginx 常用路径
反向代理配置

/etc/nginx # 默认路径 
/usr/share/nginx/html #默认html页路径

/etc/nginx/nginx.conf #配置文件

/var/log/nginx/error.log #错误日志路径

nginx -s reload

net/saga_gallon/article/details/81300921)

/etc/nginx # 默认路径 
/usr/share/nginx/html #默认html页路径

/etc/nginx/nginx.conf #配置文件

/var/log/nginx/error.log #错误日志路径

nginx -s reload

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值