Linux系统,centos7系统安装以及使用教程

CentOS 7是一种基于Linux的操作系统,是红帽(Red Hat)企业版操作系统代码的开源再编译版本,是一种稳定、可靠、高性能的服务器操作系统。下面是一份CentOS 7系统的教程。

1.安装CentOS 7

下面介绍通过 DVD 安装 CentOS 7 的步骤:

1) 首先你需要下载 CentOS 7 的 DVD 镜像文件。

2) 将下载好的 CentOS-7-x86_64-DVD.iso 文件刻录成光盘或者制作成 U 盘启动盘。

3) 将 CentOS 7 安装光盘或者 U 盘插入电脑的光驱或者 USB 端口。

4) 进入BIOS,将启动顺序和 USB 启动选择为第一位。

5) 选择 [Install CentOS 7] 开始安装。

6) 根据提示一步步进行安装 CentOS 7。

测试环境:Centos7.6系统-服务器来自:蓝易云

香港五网CN2网络 ,国内速度优秀,支持VPC内网互联、快照、备份等功能。

扫描二维码关注公众号,回复: 14688972 查看本文章

移动+联通+电信+教育网+广电-五网CN2-延迟超低!

详细测评文章:点我查看

2.设置网络

1) 通过命令 ifconfig 查看当前系统的网卡信息。

2) 编辑 /etc/sysconfig/network-scripts/ifcfg-eno16777736 文件,这里的 eno16777736 是网卡的名称,根据自己的实际情况修改文件名。

3) 将文件中的 ONBOOT=no 修改为 ONBOOT=yes。

4) 重启网络服务:systemctl restart network。

3.更新系统

1) 通过 yum update 命令,更新 CentOS 7 系统。

2) 输入 y 回车,等待系统自动更新。

4.安装和配置防火墙

1) 安装防火墙:yum install firewalld。

2) 启动防火墙:systemctl start firewalld。

3) 设置防火墙开机自启动:systemctl enable firewalld。

4) 防火墙的基本操作:

- 开启防火墙:systemctl start firewalld。
- 停止防火墙:systemctl stop firewalld。
- 重启防火墙:systemctl restart firewalld。
- 查看防火墙状态:firewall-cmd --state。
- 查看已开放端口:firewall-cmd --list-ports。
- 开放端口:firewall-cmd --add-port=[端口号]/tcp --permanent。

5.添加用户及sudo权限

1) 添加新用户:useradd [用户名]。

2) 设置密码:passwd [用户名]。

3) 将用户添加到sudoers文件可以获取管理员权限:visudo。

4) 找到 # Allow members of group wheel to execute any command,去掉前面的 #,将wheel改成自己的用户名,保存退出。

5) 退出root用户,用新建的用户重新登录。

6) 输入sudo命令进行操作,如:sudo yum install [软件名]。

7.安装和配置SSH

1) 安装ssh:yum install openssh-server。

2) 启动ssh:systemctl start sshd。

3) 设置ssh开机自启动:systemctl enable sshd。

4) 修改ssh配置:vim /etc/ssh/sshd_config。

5) 找到 Port 22,将 22 改成自己的端口号,如 2222。

6) 找到 PermitRootLogin yes,修改为 PermitRootLogin no。

7) 找到 PubkeyAuthentication yes,修改为 PubkeyAuthentication no。

8) 重启ssh:systemctl restart sshd。

9) 在本地连接ssh:ssh [用户名]@[IP地址] -p [端口号]。

以上就是CentOS 7系统的基本教程,希望对大家有所帮助。

猜你喜欢

转载自blog.csdn.net/tiansyun/article/details/129949936