[整理] wls ubuntu 配置

ubuntu config --default-user root
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
">/etc/apt/sources.list
apt update
apt upgrade -y
apt install language-pack-zh-han*
apt install manpages
apt install manpages-de
apt install manpages-de-dev
apt install manpages-dev
echo "LANG=zh_CN.utf8">/etc/default/locale
apt install proxychains4  axel git make gcc g++ -y
//curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - echo 'deb https://deb.nodesource.com/node_15.x focal main' > /etc/apt/sources.list.d/nodesource.list apt update apt install -y nodejs
//npm config set registry https://registry.npm.taobao.org
apt install zsh -y
chsh -s /bin/zsh
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
sed -i -e 's/REPO=${REPO:-ohmyzsh/ohmyzsh}/REPO=${REPO:-mirrors/oh-my-zsh}/' -e 's/REMOTE=${REMOTE:-https://github.com/${REPO}.git}/REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}/' install.sh 
chmod 777 install.sh
bash install.sh
rm -f install.sh
cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="powerlevel10k/powerlevel10k"/' ~/.zshrc

安装字体

## https://gitee.com/yzpopulation/ubuntuWSLInit/tree/master/powerlevel10kfonts
## restart wsl
## p10k configure

 yarn

npm install -g yarn
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global

 conda

axel https://mirrors.cnnic.cn/anaconda/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh
bash Miniconda3-py38_4.9.2-Linux-x86_64.sh

conda config --remove-key channels
cat > ~/.condarc <<EOF
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
EOF

// conda Bug Fix
// conda install brotlipy certifi cffi chardet cryptography idna pip pycosat pycparser pyOpenSSL PySocks requests
conda create
-n py2 python=2.7 conda update --all //bug=> conda update --force conda conda update ruamel_yaml pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
//recover=>rm -f /root/.config/pip/pip.conf pip install pip-review pip-review --local --interactive

 miniconda default pkgs

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    https://repo.anaconda.com/pkgs/main
brotlipy                  0.7.0           py38h27cfd23_1003    https://repo.anaconda.com/pkgs/main
ca-certificates           2020.10.14                    0    https://repo.anaconda.com/pkgs/main
certifi                   2020.6.20          pyhd3eb1b0_3    https://repo.anaconda.com/pkgs/main
cffi                      1.14.3           py38h261ae71_2    https://repo.anaconda.com/pkgs/main
chardet                   3.0.4           py38h06a4308_1003    https://repo.anaconda.com/pkgs/main
conda                     4.9.2            py38h06a4308_0    https://repo.anaconda.com/pkgs/main
conda-package-handling    1.7.2            py38h03888b9_0    https://repo.anaconda.com/pkgs/main
cryptography              3.2.1            py38h3c74f83_1    https://repo.anaconda.com/pkgs/main
idna                      2.10                       py_0    https://repo.anaconda.com/pkgs/main
ld_impl_linux-64          2.33.1               h53a641e_7    https://repo.anaconda.com/pkgs/main
libedit                   3.1.20191231         h14c3975_1    https://repo.anaconda.com/pkgs/main
libffi                    3.3                  he6710b0_2    https://repo.anaconda.com/pkgs/main
libgcc-ng                 9.1.0                hdf63c60_0    https://repo.anaconda.com/pkgs/main
libstdcxx-ng              9.1.0                hdf63c60_0    https://repo.anaconda.com/pkgs/main
ncurses                   6.2                  he6710b0_1    https://repo.anaconda.com/pkgs/main
openssl                   1.1.1h               h7b6447c_0    https://repo.anaconda.com/pkgs/main
pip                       20.2.4           py38h06a4308_0    https://repo.anaconda.com/pkgs/main
pycosat                   0.6.3            py38h7b6447c_1    https://repo.anaconda.com/pkgs/main
pycparser                 2.20                       py_2    https://repo.anaconda.com/pkgs/main
pyopenssl                 19.1.0             pyhd3eb1b0_1    https://repo.anaconda.com/pkgs/main
pysocks                   1.7.1            py38h06a4308_0    https://repo.anaconda.com/pkgs/main
python                    3.8.5                h7579374_1    https://repo.anaconda.com/pkgs/main
readline                  8.0                  h7b6447c_0    https://repo.anaconda.com/pkgs/main
requests                  2.24.0                     py_0    https://repo.anaconda.com/pkgs/main
ruamel_yaml               0.15.87          py38h7b6447c_1    https://repo.anaconda.com/pkgs/main
setuptools                50.3.1           py38h06a4308_1    https://repo.anaconda.com/pkgs/main
six                       1.15.0           py38h06a4308_0    https://repo.anaconda.com/pkgs/main
sqlite                    3.33.0               h62c20be_0    https://repo.anaconda.com/pkgs/main
tk                        8.6.10               hbc83047_0    https://repo.anaconda.com/pkgs/main
tqdm                      4.51.0             pyhd3eb1b0_0    https://repo.anaconda.com/pkgs/main
urllib3                   1.25.11                    py_0    https://repo.anaconda.com/pkgs/main
wheel                     0.35.1             pyhd3eb1b0_0    https://repo.anaconda.com/pkgs/main
xz                        5.2.5                h7b6447c_0    https://repo.anaconda.com/pkgs/main
yaml                      0.2.5                h7b6447c_0    https://repo.anaconda.com/pkgs/main
zlib                      1.2.11               h7b6447c_3    https://repo.anaconda.com/pkgs/main

fail2ban(ssh 防护) 

yum install fail2ban
apt install fail2ban
//centos 7
firewall-cmd --zone=public --add-prot=22/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-ports
yum install epel-release
yum install fail2ban
mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.bak
vim /etc/fail2ban/jail.local

[DEFAULT]
ignoreip=127.0.0.1/8
bantime = 86400
findtime =600
maxretry 5
banaction = firewallcmd-ipset
action= %(action_mwl)s
[sshd]
enable=true
filter = sshd
port=22
action= %(action_mwl)s
logpath=/var/log/secure

//fail2ban-client status sshd

 centos7

cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.cnnic.cn/docker-ce/linux/centos/docker-ce.repo
sed -i 's/https://download.docker.com/https://mirrors.cnnic.cn/docker-ce/' /etc/yum.repos.d/docker-ce.repo
yum makecache fast

  

原文地址:https://www.cnblogs.com/yzpopulation/p/14477327.html