您当前的位置: 首页 >  centos

江湖有缘

暂无认证

  • 0浏览

    0关注

    446博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

centos7最小化安装环境配置

江湖有缘 发布时间:2022-06-19 18:23:49 ,浏览量:0

centos7最小化安装环境配置
  • 一、配置yum仓库
    • 1.配置阿里的仓库源
    • 2.检测yum仓库
  • 二、配置tab键补齐
    • 1.安装bash-completion.noarch
    • 2.测试tab键补齐
  • 三、配置网络
  • 四、修改计算机名
  • 五、安装常用工具
    • 1.安装wget
    • 2.安装netstat命令工具
    • 3.安装git工具
    • 4.安装vim
  • 六 、配置git命令补全
    • 1.下载git相关文件
    • 2.复制文件
    • 3.修改~/.bashrc文件
    • 4.使环境变量生效
    • 5.测试git
  • 七、配置防火墙与selinux
    • 1.关闭selinux
      • ①查看当前的selinux
      • ②永久关闭selinux
      • ③临时关闭
    • 2.防火墙配置
      • ①配置防火墙放行服务
      • ②.关闭防火墙
    • 3.开启包转发功能
  • 八、检查系统磁盘空间状况

一、配置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.复制文件
mv git-completion.sh/git-completion.bash    ~/.git-completion.bash

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

关注
打赏
1665849170
查看更多评论
立即登录/注册

微信扫码登录

0.0477s