换源
ubuntu 源: sudo vim /etc/apt/sources.list
改为下面的内容, 并 sudo apt-get update
:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
pip 源: 新建 ~/.pip/pip.conf
文件加入, 并加入:
[global]
trusted-host = mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple
安装 oh-my-zsh
# 安装 zsh
sudo apt install zsh
# 检查版本
zsh --version
# 安装 oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 确认是否是默认的终端usr/bin/zsh
echo $SHELL
# 不是的话,改变默认的终端(改变后重连,再echo $SHELL检查下)
chsh -s $(which zsh)
# 查看终端列表
/etc/shells
Python 相关
# 安装 pip3
sudo apt install python3-pip
# 安装 virtualenvwrapper
pip3 install virtualenvwrapper
# 查找 virtualenvwrapper.sh 位置
sudo find ~/ -name virtualenvwrapper.sh # ~/.local/bin/virtualenvwrapper.sh
# ~/.zshrc 后面追加
`
WORKON_HOME=~/Envs
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
`
# 更新
source ~/.zshrc
安装 mysqlclient
的问题:
# 针对 mysql_config: not found
sudo apt install default-libmysqlclient-dev
# 参考链接: https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found
mysql-server
sudo apt install mysql-server
# mysql5.7 安装的时候没有提示需要设置密码
# 查看系统默认分配的用户和密码
sudo less /etc/mysql/debian.cnf
# 使用上面 [client] 部分的用户和密码登录 mysql
mysql -udebian-sys-maint -p
# 查看用户
>use mysql;
>select Host, User FROM user;
# 修改密码
>update mysql.user set authentication_string=password('newpassword') where user='root';
>flush privileges;
# 外部访问
>grant all privileges on *.* to 'root'@'%' identified by 'my_password' WITH GRANT OPTION;
>flush privileges;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 注释 bind-address = 127.0.0.1
# 重启
systemctl restart mysql
参考链接: ubuntu安装mysql初始密码忘记
安装最新版本 node.js
# 安装 node.js 和 npm
sudo apt install node.js npm
# 检查版本(不是最新的)
node --version (v8.10.0)
# 安装 n
sudo npm install n -g --registry=https://registry.npm.taobao.org
# 使用 n 安装最新的 node.js 稳定版本
sudo n stable
node --version (v10.16.0)
npm --version(v6.9.0)
npm start 报错:
npm start
出现 Error: ENOSPC: System limit for number of file watchers reached, watch '/home/...'
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
参考链接: