centos7最小化安装环境配置

Posted 江湖有缘

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7最小化安装环境配置相关的知识,希望对你有一定的参考价值。

centos7最小化安装环境配置

一、配置yum仓库

1.配置阿里的仓库源

[root@192 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

2.检测yum仓库

[root@192 yum.repos.d]# yum repolist all |grep enable
base/7/x86_64               CentOS-7 - Base - mirrors.aliyun.com enabled: 10,072
extras/7/x86_64             CentOS-7 - Extras - mirrors.aliyun.c enabled:    512
updates/7/x86_64            CentOS-7 - Updates - mirrors.aliyun. enabled:  3,875

二、配置tab键补齐

1.安装bash-completion.noarch

yum -y install bash-completion.noarch

2.测试tab键补齐

需重启生效

[root@192 ~]# yum list a
all        available  
[root@192 ~]# yum list a

三、配置网络

[root@192 ~]# nmcli connection modify ens33 ipv4.addresses 192.168.3.201/24 ipv4.gateway 192.168.3.254 ipv4.dns 192.168.3.254 ipv4.method manual 
[root@192 ~]# nmcli con reload 
[root@192 ~]# nmcli con up ens33 

四、修改计算机名

[root@192 ~]# hostnamectl set-hostname node01

五、安装常用工具

1.安装wget

 yum -y install wget

2.安装netstat命令工具

 yum -y install net-tools-2.0-0.25.20131004git.el7.x86_64

3.安装git工具

yum -y install git

4.安装vim

[root@192 ~]# yum install -y vim

六 、配置git命令补全

1.下载git相关文件

[root@192 ~]# git clone https://github.com/markgandolfo/git-bash-completion.git

2.复制文件

[root@192 ~]# git clone https://github.com/markgandolfo/git-bash-completion.git

3.修改~/.bashrc文件

[root@192 ~]# cat ~/.bashrc 
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

if [ -f ~/.git-completion.bash ]; then
        . ~/.git-completion.bash
fi

4.使环境变量生效

[root@192 ~]# source ~/.bashrc 

5.测试git

[root@192 ~]# git co
column          commit          config          count-objects   
[root@192 ~]# git co

七、配置防火墙与selinux

1.关闭selinux

①查看当前的selinux

[root@192 ~]# getenforce 
Enforcing

②永久关闭selinux

[root@192 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

③临时关闭

[root@192 ~]# setenforce 0
[root@192 ~]# getenforce 
Permissive

2.防火墙配置

①配置防火墙放行服务

[root@192 ~]# firewall-cmd --permanent --add-port=80/tcp
success
[root@192 ~]# firewall-cmd --reload 
success

②.关闭防火墙

[root@192 ~]# systemctl stop firewalld.service 
[root@192 ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

3.开启包转发功能

[root@192 ~]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

八、检查系统磁盘空间状况

[root@192 ~]# fdisk -l

Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009df2e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     4196351     2097152   83  Linux
/dev/sda2         4196352    29362175    12582912   83  Linux
/dev/sda3        29362176    37750783     4194304   83  Linux
/dev/sda4        37750784   251658239   106953728    5  Extended
/dev/sda5        37752832   251658239   106952704   83  Linux
[root@192 ~]# df  -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5       102G  1.1G  101G   2% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G   12M  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2        12G   33M   12G   1% /home
/dev/sda3       4.0G  377M  3.7G  10% /var
/dev/sda1       2.0G  127M  1.9G   7% /boot
tmpfs           797M     0  797M   0% /run/user/0

开发者涨薪指南 48位大咖的思考法则、工作方式、逻辑体系

以上是关于centos7最小化安装环境配置的主要内容,如果未能解决你的问题,请参考以下文章

最小安装模式下Centos7.*网卡启动配置

linux CentOS7最小化安装环境静默安装Oracle11GR2数据库(静默创建实例)

CentOS7安装配置vncserver

Linux之Sell脚本实战Centos最小化安装环境配置脚本

CentOS7最小化源码安装LAMP-步骤详解

Oracle 11g 基于CentOS7静默安装教程(无图形界面,远程安装)