Centos7安装完成后一些基本操作

基本操作一:主机名
centos7有一个新的修改主机名的命令hostnamectl
# hostnamectl set-hostname --static www.node1.com
# vim /etc/hosts	--最后加上你的IP与主机名的绑定
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.254.10  www.node1.com 

基本操作二:关闭iptables
# systemctl status firewalld.service	--查看firewalld服务的状态,active是启动状态,inactive是关闭状态
# systemctl stop firewalld.service	--关闭此服务
# systemctl list-unit-files |grep firewalld	--查看firewalld是否开机自动启动
firewalld.service                           enabled 

# systemctl disable firewalld.service	--类似以前的chkconfig xxx off
# systemctl list-unit-files |grep firewalld
firewalld.service                           disabled

基本操作三:关闭selinux
# sed -i 7s/enforcing/disabled/  /etc/selinux/config	--改完后,在后面重启系统生效

基本操作四:网络配置
# systemctl stop NetworkManager		--停止服务
# systemctl status NetworkManager	--查看状态,确认为关闭了
# systemctl disable NetworkManager	--设置为开机不自动启动
# vim /etc/sysconfig/network-scripts/ifcfg-enp2s0	--网卡名如果不一样,找到对应的文件就行
BOOTPROTO="static"
NAME="enp2s0"
DEVICE="enp2s0"
ONBOOT="yes"
IPADDR=192.168.254.10
NETMASK=255.255.255.0
GATEWAY=192.168.254.2
DNS1=114.114.114.114
# /etc/init.d/network restart		--network服务这里默认还是可以使用原来的管理方法
# chkconfig network on

基本操作五:yum配置
,配置本地yum源
# rm /etc/yum.repos.d/* -rf	--这里我删除了它所有的默认的配置(因为这些默认配置要连公网的源,速度太慢)
# vim /etc/yum.repos.d/local.repo	--然后自建了本地yum源配置文件
[local]
name=local
baseurl=file:///yum
enabled=1
gpgcheck=0

,配置可选163的centos源
163centos源(其实就是centos官方的yum,使用163的国内速度更快)
配置方法两种
a)直接公网连接网易163,优点:速度快,软件包会定期更新
# cd /etc/yum.repos.d/
# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
b)自己编写
# vim /etc/yum.repos.d/cento163.repo
[centos163]
name=centos163
baseurl=http://mirrors.163.com/centos/7.3.1611/os/x86_64
enabled=1
gpgcheck=0

,配置可选epel源
配置方法两种
a)直接公网连接epel,优点:速度快,软件包会定期更新
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm	--此版本信息会随时间推移而变化
# rpm -ivh epel-release-7-10.noarch.rpm
b)自己编写
# vim /etc/yum.repos.d/epel.repo
[epel]
name=epel
baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64
enabled=1
gpgcheck=0
配置完上面三个yum后
# yum clean all
# yum makecache fast

基本操作六:输入法配置
默认只有拼音中文输入法,需要使用极点五笔输入法,安装过程如下:
# yum install ibus ibus-table-chinese-wubi-jidian
安装完后,需要右上角把用户注销重登录
左上角applications--system tools -- settions -- Region & Language -- +或-你的输入法就可以了
加完之后,使用super+space键进行切换

基本操作七:时间同步
# yum install ntp  ntpdate	--安装ntp时间同步相关软件包
# vim /etc/ntp.conf		--确认配置文件里有下列的时间同步源
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
# systemctl enable ntpd		--设置开机自动启动ntpd
# systemctl start ntpd		--立即启动ntpd服务
# date				--确认时间与现在时间一致
# ntpdate 0.rhel.pool.ntp.org	--如果还没有同步成功,你可以用此命令手动同步一下

另外一个时间服务器的搭建方法
# yum install xinetd -y
# vim /etc/xinet.d/time-dgram
	disable         = no	(--yes改为no)
# vim /etc/xinetd.d/time-stream
	disable         = no	(--yes改为no)
# systemctl restart xinetd
# systemctl status xinetd
# systemctl enable xinetd
客户端同步时间的用法
# rdate -s 时间服务器的ip

基本操作八:
有些命令的参数可以自动补全,如果不能补全,则安装下面的命令(可能需要注销一下)
# yum install bash-completion

基本操作九:vnc的配置
# vncpasswd 		--设定vcn连接的密码
Password:
Verify:
# x0vncserver --PasswordFile=/root/.vnc/passwd --AlwaysShared=on --AcceptKeyEvents=off AcceptPointerEvents=off &> /dev/null &

基本操作十:桌面锁屏
左上角applications--system tools -- settions -- Privacy  设置是否自动锁屏
手动锁屏
super+l 

基本操作十一:图形界面快捷键修改
左上角applications--system tools -- settions -- Keyboard -- Shortcuts   去修改自己习惯的快捷键

基本操作十二:设置默认启动级别为图形模式(相当于以前的5级别)
# systemctl get-default			--查看当前的运行模式
# systemctl set-default graphical.target	--设置图形模式为默认模式

原文地址:https://www.cnblogs.com/fawaikuangtu123/p/9656652.html

时间: 2024-08-14 07:59:20

Centos7安装完成后一些基本操作的相关文章

Centos7安装完毕后重启提示Initial setup of CentOS Linux 7 (core)的解决方法

问题: CentOS7安装完毕,重新开机启动后显示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License information (no user will be created) (license not accepted) Please make your choice from above ['q' to quit | 'c' to continue | 'r' to refresh]: 解决方法:

CentOS7安装mysql后无法启动服务,提示Unit not found

1.最近在centos7上面进行mysql安装完成后,无法启动,报如下错误: Failed to start mysql.server.service: Unit not found. 2.这个是知乎上面找到的无法启动的答案:https://www.zhihu.com/question/41832866 3.解决办法一:使用MariaDB代替mysql数据库(MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.开发这个分支的原因之一是:甲骨文公司收购了M

centos7 安装 iRedmail 后 给nginx添加虚拟主机

iRedmail安装参考官方文档和 https://ywnz.com/linuxyffq/4563.html 准备工作 更新操作系统 yum update -y 安装必要组件 yum install perl perl-core ntpl nmap sudo libidn gmp libaio libstdc++ unzip sysstat wget nc -y 停止任何安装在该Centos7 Server上面的 MTA服务 systemctl stop postfix systemctl di

【待续】Centos7安装完后无法进入图形界面(GNOME/KDE)的解决方

(尝试,不成功) 今天尝试安装centos7时碰到了 在安装过程中选择了安装桌面环境,但重启后还是只能进入Linux Core的tty命令行界面. 具体解决问题方法如下: 长话短说,一句命令解决问题 ln -sf /lib/systemd/system/graphical.taget /etc/systemd/system/default.target 接着 reboot now 重启之后就能看到亲爱的图形界面拉: (尝试,思路) xinit: connection to X server lo

Centos7安装完后,重新启动系统提示Initial setup of CentOS Linux 7 (Core)的解决办法

今天安装完Centos7(CentOS-7-x86_64-DVD-1511.iso)后,重新启动系统提示Initial setup of CentOS Linux 7 (Core): 解决办法: 按提示步骤分别输入"1"."2"."q"."yes"即可.

VMware虚拟机中的CentOS7安装Nginx后本机无法访问的解决办法

在虚拟机centos7上安装nginx之后虚拟机内能访问,真机不能访问,修改iptables配置也不起作用,最后上网查找了资料后才发现centos的防火墙改成了firewall,不再叫iptables,开放端口的方法如下: firewall-cmd --zone=public --add-port=80/tcp --permanent 命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 重

解决 CentOS7 安装完成后ifconfig命令不能用

今天用VMWare安装了CentOS7,选择了最小安装包模式,安装完毕之后想查看一下本机的ip地址,发现报错 # ifconfig -bash: ifconfig: command not found 谷歌了一下,整理了一下解决思路 查看ifconfig命令是否存在 查看 /sbin/ifconfig是否存在 如果ifconfig命令存在,查看环境变量设置 #echo $PATH 如果环境变量中没有包含ifconfig命令的路径 临时修改环境变量:在shell中输入 $export PATH =

Centos7安装完毕后无法联网的解决方法

今天在VMware虚拟机中经过千辛万苦终于安装好了centos7..正兴致勃勃的例行yum update 却发现centos系统貌似默认网卡没配置好,反馈无法联网.经过一番研究,终于让centos连上了网,方法如下: 进入目录: /etc/sysconfig/network-scripts/ 用ls命令查看网卡配置文件名(在CENTOS7中网卡名貌似变成了随机数字,所以每台机器的网卡名并不相同) 用vim(或者vi,随你便咯)编辑该文件 将最后一行的ONBOOT=no改为ONBOOT=yes,如

Centos7安装完毕后联网-设置ip地址(VMware虚拟机)

VMware虚拟机中安装了Centos7,为了让Centos能够访问外网及设置固定的ip地址以方便本地通过SSH访问Centos,做以下几步.本文来自osfipin note. 1.确认虚拟机网络链接方式为:NAT模式 2.查看Centos当前ip地址(局域网内),命令: 1 ip addr 3.进入网络配置目录: 1 cd /etc/sysconfig/network-scripts 4.查看所有配置文件 1 ls #列出文件 5.辨别使用的网卡文件,一般文件名以ifcfg-开头,末尾有(随机