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.复制文件

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
相关文章
|
7天前
|
Linux 数据库管理 Python
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
66 4
|
2天前
|
Oracle 关系型数据库 MySQL
centos6安装mariadb失败及解决办法
centos6安装mariadb失败及解决办法
19 4
|
2天前
|
关系型数据库 MySQL Linux
CentOS7.9 安装 mysql-8.0.36 踩坑小记
CentOS7.9 安装 mysql-8.0.36排错指南
38 1
|
8天前
|
tengine Linux 应用服务中间件
CentOS 7 安装 Tengine
CentOS 7 安装 Tengine
|
10天前
|
Ubuntu Java Linux
Linux centos7 ubuntu 一键安装Java JDK 脚本 shell 脚本
Linux centos7 ubuntu 一键安装Java JDK 脚本 shell 脚本
|
10天前
|
Ubuntu 应用服务中间件 Linux
Linux Centos7 ubuntu 安装nginx,脚本一键安装nginx
Linux Centos7 ubuntu 安装nginx,脚本一键安装nginx
|
10天前
|
关系型数据库 MySQL Linux
centos linux mysql 5.5脚本全自动源码包 编译安装
centos linux mysql 5.5脚本全自动源码包 编译安装
|
11天前
|
开发工具
centos8 yum安装mysql8 流程配置
centos8 yum安装mysql8 流程配置
|
11天前
|
Linux 应用服务中间件 开发工具
centos linux 通过yum安装nginx
centos linux 通过yum安装nginx
|
12天前
|
Docker 容器 Linux
蓝易云 - 在CentOS中安装Docker Engine
以上步骤完成后,你就成功地在CentOS上安装了Docker Engine。
64 2