目录
一、修改配置文件
1.1关闭防火墙
实验环境下,配置服务过程中,可能端口被防火墙拦截,配置防火墙还是比较麻烦,所以关闭更省时。
[root@localhost ~] systemctl disable --now firewalld #永久关闭防火墙并立即生效
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~] setenforce 0 #关闭selinux
[root@localhost ~] sed -i "7c SELINUX=disabled" /etc/sysconfig/selinux #永久关闭selinux
1.2配置便携功能
设置行号后,使用vim编辑器时会方便很多。
[root@localhost ~] vi /etc/passwd
#设置行号,使用vim时自带行号
set nu
#防止粘贴时出现乱码
set paste
二、yum安装常用
这些都是很常用的,就像拿到新电脑后会安装常用软件
#安装vim命令
yum install vim -y
#安装ifconfig命令
yum install net-tools -y
#安装wget命令
yum install wget -y
#安装文件上传、导出功能
yum install lrzsz -y
#安装tab补全功能
yum install bash-completion -y
source /etc/profile.d/bash_completion.sh
#安装压缩/解压功能
yum -y install unzip zip
#安装epel源
yum install epel-release -y
四、修改字体大小和颜色
进入字体所在目录
cd /lib/kbd/consolefonts
查看可设置字体
ls
设置想要的字体
setfont 字体名字
如:
setfont latarcyrheb-sun32.psfu.gz #后面的数字越大,字体越大
修改字体颜色为绿色,根据自己的喜好设置
setterm -forceground green
设置开机自启
echo 'setfont latarcyrheb-sun32.psfu.gz’ >> /etc/bashrc
echo 'setterm -forceground green' >> /etc/bashrc
yum仓库
网络yum源一般是指163、suhu、阿里、中国科技大学等公共的网络yum源,或者是自建的局域网yum仓库。镜像里的资源比较少。
配置网络yum源有2种方式,一种是直接下载官方的yum配置文件替换到本地,另一种是修改本地的yum配置文件中的baseurl地址。
方式一:本地源
第一步挂载镜像到指定目录写配置文件到/etc/yum.repo.d/ 目录下
[root@localhost ~]# mkdir /mnt/centos7 #创建目录
[root@localhost ~]# mount /dev/sr0 /mnt/centos7/ #挂载到指定目录
mount: /dev/sr0 写保护,将以只读方式挂载
[Centos]
name=CentOS-$releasever - Media
baseurl=file:///mnt/centos7 #镜像挂载的目录
gpgcheck=1
enabled=1
2、清理缓存,建立元数据
[root@localhost ~]# yum clean all && yum makecache
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.ustc.edu.cn
* extras: mirror.nyist.edu.cn
* updates: mirrors.ustc.edu.cn
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:00
(3/10): base/7/x86_64/other_db | 2.6 MB 00:00:00
(4/10): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(5/10): extras/7/x86_64/primary_db | 250 kB 00:00:00
(6/10): extras/7/x86_64/other_db | 150 kB 00:00:00
(7/10): extras/7/x86_64/filelists_db | 303 kB 00:00:00
(8/10): updates/7/x86_64/filelists_db | 12 MB 00:00:00
(9/10): updates/7/x86_64/other_db | 1.4 MB 00:00:00
(10/10): updates/7/x86_64/primary_db | 22 MB 00:00:00
元数据缓存已建立
方式二:直接下载网络源配置文件
1、备份原镜像文件
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2、下载
# wget -O /etc/yum.repos.d/CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
# wget -O /etc/yum.repos.d/CentOS-Base-aliyun.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3、清理缓存,生成元
# yum clean all #清除缓存
# yum makecache #生成(刷新)缓存