阿里云服务器操作记录

阿里云服务器默认不开启 root 远程登录

需要先进行 VNC 远程连接登录,再进行实例登录。

可以在Mac的命令行进行登录

ssh root@你的公网地址
password 你的密码

阿里云 centos 安装 nginx

yum install nginx

就一条命令就行,yum 会自动帮我们安装 nginx 所需要的依赖的

如果出现错误,那么就是 etc/yum.repos.d/CentOS-AppStream.repo 里面的镜像源出现了错误。

2022.02.16(出现了镜像源改变,所以我们需要改配置文件里面的路径)

将这个文件夹下的所有

baseurl=http://mirrors.cloud.aliyuncs.com/$contentdir/$releasever/AppStream/$basearch/os/

改成:

baseurl=https://mirrors.aliyun.com/$contentdir/$releasever-stream/AppStream/$basearch/os/

比如:

# CentOS-AppStream.repo
#
# 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.
#
#

[AppStream]
name=CentOS-$releasever - AppStream
#baseurl=http://mirrors.cloud.aliyuncs.com/$contentdir/$releasever/AppStream/$basearch/os/
#改为下面这个
baseurl=http://mirrors.aliyuncs.com/$contentdir/$releasever-stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

安装成功,配置端口之后重启服务即可

------------- 本文结束 感谢阅读 -------------