目录
我使用的是ubuntu22.04LTS版本
apt切换国内源(清华大学)
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 http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
配置在~/.bashrc或~/.zshrc等等环境配置文件中
注意你自己安装的路径
# jdk
export JAVA_HOME17=/usr/local/lib/jdk-17
export JAVA_HOME21=/usr/local/lib/jdk-21
export JRE_HOME17=${JAVA_HOME17}/jre
export JRE_HOME21=${JAVA_HOME21}/jre
# maven
export MAVEN_HOME=/usr/local/lib/apache-maven-3.9.6
# nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# PATH
export CLASSPATH=.:${JAVA_HOME21}/lib:${JRE_HOME21}/lib
export PATH=${JAVA_HOME21}/bin:${MAVEN_HOME}/bin:$PATH
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
mysql相关配置
sudo apt-get install mysql-server
不需要输入密码,直接回车
sudo mysql -uroot -p
mysql> use mysql;
#开启远程连接
update user set host='%' where user='root';
#修改了之后刷新以下权限
flush privileges;
#修改数据库密码.(MySQL8.0)
ALTER USER 'root'@'%' identified with mysql_native_password BY '123456';
#修改了之后刷新以下权限
flush privileges;
#退出数据库
quit;
安装docker:
docker在ubuntu中需要的一些依赖
apt-get install ca-certificates curl gnupg lsb-release
添加Docker官方GPG密钥:
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
添加Docker软件源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
安装docker
apt-get install docker-ce docker-ce-cli containerd.io
配置用户组(只有root用户和docker组的用户才能运行Docker命令,更改后需要重新登陆)
sudo usermod -aG docker $USER
启动docker
systemctl start docker
安装工具
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
重启docker
systemctl restart docker
验证是否成功(出现Unable to find image 'hello-world:latest' locally就成功了)
sudo docker run hello-world
docker中处理mysql乱码问题
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_0900_ai_ci
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
安装oh my zsh
安装zsh
sudo apt install zsh
安装所需的构建工具
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev
安装oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
自动提示插件
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
语法高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
修改~/.zshrc
vim ~/.zshrc
# 找到plugins
plugins=(git zsh-autosuggestions docker zsh-syntax-highlighting ruby)
加载zshrc
source ~/.zshrc
设置zsh为默认shell
chsh -s $(which zsh)
可以去官网换主题
# 在zshrc中,换主题,我使用的是amuse
ZSH_THEME="robbyrussell"