ubuntu终端配置 使用zsh+starship 配置终端。
安装配置zsh 1 2 3 4 5 6 7 8 9 10 11 12 sudo apt install zsh chsh -s /bin/zsh sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh) " sh -c "$(curl -fsSL https://gitee.com/why168/ohmyzsh/raw/master/tools/install.sh) "
安装常见插件 zsh配置文件默认在 ~/.zshrc
zsh-autosuggestions
1 2 3 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-autosuggestions
zsh-syntax-highlighting
1 2 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-syntax-highlighting
安装完插件还需要在.zshrc
上配置一下:
1 2 3 4 5 6 7 plugins=( git extract autojump zsh-autosuggestions zsh-syntax-highlighting )
安装配置starship startship官网地址 shell提示工具
1 2 3 4 5 6 curl -fsSL https://starship.rs/install.sh | bash eval "$(starship init zsh) "
ubuntu打不开VMware 当Ubuntu升级内核后,可能会出现卡不开vmware的情况。解决方法如下:
写一个脚本:vm_udpate.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #!/bin/bash VMWARE_VERSION=workstation-15.6.1 TMP_FOLDER=/tmp/patch-vmware rm -fdr $TMP_FOLDER mkdir -p $TMP_FOLDER cd $TMP_FOLDER git clone https://github.com/mkubecek/vmware-host-modules.git cd $TMP_FOLDER /vmware-host-modulesgit checkout $VMWARE_VERSION git fetch make sudo make install sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1 sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1 sudo /etc/init.d/vmware restart
主流编程语言环境配置 python pip换源加速: windows:
1 2 3 4 5 6 7 8 9 10 """ 1、win+R,输入%APPDATA% 回车,快速进入 C:\Users\电脑用户\AppData\Roaming 文件夹中 2、新建pip文件夹并在文件夹中新建 pip.ini配置文件 3、新建pip.ini 配置文件内容如下 """ [global ] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
Linux:
1 2 3 4 5 1 、在用户根目录下 ~ 下创建 .pip 隐藏文件夹,如果已经有了可以跳过 -- mkdir ~/.pip 2 、进入 .pip 隐藏文件夹并创建 pip.conf 配置文件 -- cd ~/.pip && touch pip.conf 3 、新增 pip.conf 配置文件内容,与windows一样
虚拟环境 Linux:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 sudo pip install virtualenv sudo pip install virtualenvwrapper mkdir ~/.virtualenvsexport WORKON_HOME=~/.virtualenvexport VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenvsource /usr/local/bin/virtualenvwrapper.shsource ~/.zshrc
windows:
1 2 3 4 pip install virtualenv pip install virtualenvwrapper-win
简单使用:
1 2 3 4 5 6 mkvirtualenv -p python3 虚拟环境名称 workon 虚拟环境名称 deactivate
java windows:
新建环境变量:
1 2 3 4 5 6 %JAVA_HOME%\bin %JAVA_HOME%\jre\bin
Linux:
1 2 3 4 5 6 7 8 9 sudo vim /etc/profile export JAVA_HOME=/usr/local/jdk1.8.0_261export JRE_HOME=${JAVA_HOME} /jreexport CLASSPATH=.:${JAVA_HOME} /lib:${JRE_HOME} /libexport PATH=${JAVA_HOME} /bin:$PATH source /etc/profiles
golang 1 2 3 4 export GOROOT=/usr/local/goexport GOPATH=/home/cwz/workspace/golang_codesexport PATH=$GOPATH /bin:$GOROOT /bin:$PATH
nodejs 1 2 3 export NODE_HOME=/usr/local/node-v12.18.4-linux-x64export PATH=$NODE_HOME /bin:$PATH
1 2 3 4 5 6 7 8 npm config set registry https://registry.npm.taobao.org npm config get registry npm install -g cnpm --registry=https://registry.npm.taobao.org
包管理工具以及配置加速源 maven配置:
1 2 3 4 5 sudo vim /etc/profile export MAVEN_HOME=/usr/local/apache-maven-3.6.3export PATH=$MAVEN_HOME /bin:$PATH
打开 Maven 的配置文件(windows机器一般在maven安装目录的conf/settings.xml),在<mirrors></mirrors>
标签中添加 mirror 子节点:
1 2 3 4 5 6 <mirror > <id > aliyunmaven</id > <mirrorOf > *</mirrorOf > <name > 阿里云公共仓库</name > <url > https://maven.aliyun.com/repository/public</url > </mirror >
常见数据库安装配置 mysql 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm yum localinstall mysql80-community-release-el7-3.noarch.rpm yum-config-manager --disable mysql80-community yum-config-manager --enable mysql57-community yum install mysql-community-server systemctl start mysqld grep 'temporary password' /var/log/mysqld.log show variables like '%validate_password_policy%' ; show variables like '%validate_password_length%' ; set global validate_password_policy=0;set global validate_password_length=1;ALTER USER 'root' @'localhost' IDENTIFIED BY 'MyNewPass4!' ; flush privileges; GRANT ALL PRIVILEGES ON *.* TO 'root' @'%' IDENTIFIED BY '123456' ; flush privileges;
postgresql ubuntu安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 sudo apt install postgresql sudo -u postgres psql temlpate1 alter user postgres with encrypted password 'your_password' ; \q vi /etc/postgres/9.5/main/pg_hba.conf loacl all postgres md5 sudo systemctl restart postgresql.service psql -U postgres -W -d dbname /etc/postgresql/<version>/main /etc/postgresql/10/main/pg_ident.conf /etc/postgresql/10/main/postgresql.conf
centos7安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 yum install -y postgresql-server service postgresql initdb systemctl start postgresql systemctl enable postgresql psql -U postgres alter user postgres with encypted password '123' ; vim /var/lib/pgsql/data/pg_hba.conf psql -U postgres -W vim /var/lib/pgsql/data/postgresql.conf listen_addresses = '*' host all all 0.0.0.0/0 md5 systemctl restart postgresql
redis 编译安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 mkdir rediscd rediswget http://download.redis.io/releases/redis-5.0.7.tar.gz tar xf redis-5.0.7.tar.gz cd redis-5.0.7 && vim README.mdmake yum install gcc -y make distclean make make PREFIX=/opt/redis install vim /etc/profile ... export REDIS_HOME=/opt/redisexport PATH=$PATH :$REDIS_HOME /bin... source /etc/profilecd utils./install_server.sh