Linux Config

Ubuntu 初始化的一些简单配置

ssh 配置

  • 安装 ssh

    apt-get install opnessh-server

  • 如果出现错误 Connection closed by ip

    sudo dpkg-reconfigure openssh-server

    然后再重新修改一些端口等配置

更换国内源,阿里云源感觉不是很稳定,一般用中科大的

vim /etc/apt/sources.list
删除原有的

替换为

1
2
3
4
5
6
7
8
9
10
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

sudo apt-get update
sudo apt-get upgrade

安装 zsh

sudo apt-get install zsh

chsh -s /bin/zsh

sudo apt-get install git

配置 git

  • 配置个人信息
1
2
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
  • 生成 SSH

$ ssh-keygen -t rsa -C “youremail@example.com

sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”

更换主题 agnoster

安装 nodejs

  • 安装最新 nodejs 方法

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

替换 npm 源

1.临时使用

npm –registry https://registry.npm.taobao.org install express

2.持久使用

npm config set registry https://registry.npm.taobao.org
// 配置后可通过下面方式来验证是否成功
npm config get registry
// 或
npm info express

3.通过 cnpm 使用

npm install -g cnpm –registry=https://registry.npm.taobao.org
// 使用
cnpm install expresstall express

Centos 一些配置

ifconfig command not found

yum install net-tools