最小环境安装常用工具+配置
1.安装epel-release源
1
yum install epel-release -y
2.常用工具
1
2
3
4
5
6
7
8
9
有些软件安装不上需要执行第一步
yum -y install htop vim wget curl net-tools lsof zip unzip ifconfig iftop lrzsz bind-utils git jq iptables iptables-services supervisor fail2ban telnet telnet-server ntp bash-completion nc sysstat iproute
注:
bind-utils nslookup
iostat sysstat
apk add busybox-extras telnet
3.关闭 selinux
1
2
3
4
5
vim /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
保存,退出
4.防火墙
1
2
3
systemctl stop firewalld
systemctl disable firewalld
systemctl enable iptables
5.配置bash_profile|.bashrc文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# MAC 里面的配置(适当减少)
export PS1='\[\033[01;36m\][\u@\h\[\033[01;32m\] \W\[\033[01;36m\]]\[\033[01;32m\]\$\[\033[00m\] '
export CLICOLOR=1
export LSCOLORS=ExGxFxdaCxDaDahbadache
export BASH_SILENCE_DEPRECATION_WARNING=1
# HomeBrew
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
# HomeBrew END
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
complete -W "$(echo $(grep '^host ' ~/.ssh/config | sort -u | sed 's/^ssh //'))" ssh
complete -W "$(echo $(grep '^host ' ~/.ssh/config | sort -u | sed 's/^scp //'))" scp
alias l='gls -l'
alias ll='gls --color=auto -lh --time-style=long-iso'
alias la='gls --color=auto -lFah --time-style=long-iso'
alias ss='netstat'
alias cdmkitdb='cd /Users/de-lovely/DataStorage/MKgits/abdocs/alter-table'
alias cdmkit='cd /Users/de-lovely/DataStorage/MKgits'
alias cdsgit='cd /Users/de-lovely/DataStorage/SelfGits'
alias cdst='cd /Users/de-lovely/DataStorage/Study_Save'
alias sshjumpserver='ssh jumpserver'
alias iftop='sudo iftop'
alias sftp='with-readline sftp'
export PATH="/usr/local/opt/openssh/bin:$PATH"
#退出终端,忽略: EOF; 或者 连续按 ctrl+d 3次
set -o ignoreeof
#export IGNOREEOF=2
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
#export PATH
#####################################################################################
##虚拟环境 python 无法安装python3.6.5 版本
#export PATH="$HOME/.pyenv/bin:$PATH"
#export PATH="/usr/local/bin:$PATH"
#
##python 虚拟环境
#eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"
#export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
#export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
#
#if which pyenv-virtualenv-init > /dev/null;
# then eval "$(pyenv virtualenv-init -)";
#fi
#####################################################################################
#export LANG="zh_CN.UTF-8"
#export LC_ALL="zh_CN.UTF-8"
export LANG=en_US.UTF-8
# 安装coreutils 时的提示
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# linux 配置
# .bashrc
export PS1='\[\033[01;36m\][\u@\h\[\033[01;32m\] \W\[\033[01;36m\]]\[\033[01;32m\]\$\[\033[00m\] '
export CLICOLOR=1
export LSCOLORS=ExGxFxdaCxDaDahbadache
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ll='ls --color=auto -lh --time-style=long-iso'
alias la='ls --color=auto -la --time-style=long-iso'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
6. 换yum源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 1. 备份:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# 2. 换阿里云源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#3. 换 清华大学 源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/repo/Centos-7.repo
# 更新缓存:
yum clean all
yum makecache
本文由作者按照
CC BY 4.0
进行授权