Ubuntu 常用环境配置记录

引言

经常使用 Ubuntu 虚拟机,双系统,WSL,服务器等等,每次配置常用开发环境都要去百度细节,故在此记录一下。

更换软件源

# 更新
sudo apt update && sudo apt upgrade

配置 nodejs

# 安装 nodejs 14.x版本
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs

# 更换 npm 源
npm config set registry http://registry.npm.taobao.org/

配置 mongodb

# 导入包管理系统使用的公钥
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -

# 为MongoDB创建一个列表文件(对于18.04)
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

# 更新并安装
sudo apt update && sudo apt install -y mongodb-org

# 锁定安装版本
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

# 启动 mongodb
sudo mkdir -p /data/db
sudo mongod --fork --logpath=/data/mongod.log

配置 jupyter

# 安装 pip3
sudo apt install python3-pip

# 切换 pip 镜像源
mkdir ~/.pip
echo "[global]" > ~/.pip/pip.conf
echo "index-url = https://mirrors.aliyun.com/pypi/simple" >> ~/.pip/pip.conf

# 安装 jupyter
sudo pip3 install jupyter

# 设置密码
jupyter notebook password

# 切换 jupyter 工作区
mkdir ~/jupyter && cd ~/jupyter

# 后台运行 jupyter
nohup jupyter notebook --no-browser --port 8888 > ~/.jupyter/jupyter.log 2>&1 &

总结

不断更新~

原文链接 https://www.cnblogs.com/gengxk628/

猜你喜欢

转载自www.cnblogs.com/gengxk628/p/12785044.html
今日推荐