Linux个人工作环境配置(持续更新) 在迁移到新的Linux系统时,可以用以下来配置个人工作环境,以快速恢复效率✨
本文环境:Ubuntu 22.04 LTS
1 系统配置 配置代理
可直接在 Settings > Network > Network Proxy > Manual 图形界面中配置系统代理http_proxy和https_proxy,注意不只需写ip和port,不需要在ip前加protocol。然后重启NetworkManager生效。
1 sudo systemctl restart NetworkManager
1 2 3 4 5 6 7 8 9 10 11 12 export http_proxy=http://PROXY_IP:PROXY:PORTexport https_proxy=http://PROXY_IP:PROXY:PORTsudo touch /etc/profile.d/my_proxy.shecho "export http_proxy=http://PROXY_IP:PROXY:PORT" >> /etc/profile.d/my_proxy.shecho "export https_proxy=http://PROXY_IP:PROXY:PORT" >> /etc/profile.d/my_proxy.shecho "no_proxy=\"localhost, 127.0.0.1\"" >> /etc/profile.d/my_proxy.shsudo chmod +x /etc/profile.d/my_proxy.shsource /etc/profile.d/my_proxy.sh
1 2 timeout 5s curl -I google.com && echo success || echo fail
配置代理的一个大坑:保证http_proxy等代理对sudo生效(不论当前用户是否为root,都需要添加以下内容)
1 2 Defaults env_keep += "http_proxy https_proxy ftp_proxy"
更换镜像源
1 2 3 4 5 6 7 8 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
1 2 3 4 5 git clone git@github.com:QGrain/My-Awesome-Configuration.git awesome-confpushd awesome-conf/mirror-sourcechmod u+x change-mirror-source.sh ./change-mirror-source.shpopd
其他的坑
再记录一个关于Ubuntu 22 in VMware的坑
安装[open-vm-tools, open-vm-tools-desktop]和vmware-tools是互斥的两个
2 软件配置 常用软件 1 2 3 4 5 6 7 8 sudo apt install -y net-tools openssh-server curl inetutils-pingsudo apt install -y screen tmuxsudo apt install -y htop screenfetch
Git
1 2 3 4 5 6 7 8 9 10 sudo apt install git git config --global user.name "GIT_USERNAME" git config --global user.email "GIT_EMAIL" git config --global http.https://github.com.proxy "socks5://PROXY_IP:PROXY_PORT" git config --global https.https://github.com.proxy "socks5://PROXY_IP:PROXY_PORT"
1 2 3 4 5 6 7 8 9 10 11 ssh-keygen -t rsa -C "YOUR_COMMENT" ssh -T git@github.com 20.205.243.166 github.com
好用的插件⭐
gitlen:功能包括但不限于行末显示代码commit历史
gitblame:See git blame information in the status bar.
Compare Folder:对比文件夹
Remote - SSH(WSL):远程连接服务器
vscode-icons:给文件和文件夹替换精美icon
Markdown All in One:markdown插件
Vim
1 2 3 4 sudo apt install vim wget -c https://raw.githubusercontent.com/QGrain/My-Awesome-Configuration/master/vim/vimrc -O ~/.vimrc
Oh-My-Zsh
1 2 3 4 5 6 7 8 9 10 11 sudo apt install zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) " wget -c https://raw.githubusercontent.com/QGrain/My-Awesome-Configuration/master/zsh/zshrc -O ~/.zshrcsource ~/.zshrc
1 2 3 4 5 6 7 8 9 if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset ifi
neovim fzf 1 2 git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install
cmake
源码安装指定版本,我曾经写过一个脚本,但是没空找了
miniconda3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.shchmod u+x ./Miniconda3-py38_4.12.0-Linux-x86_64.sh ./Miniconda3-py38_4.12.0-Linux-x86_64.shsudo touch /etc/profile.d/my_software.shecho "export PATH=$PATH :/home/$USER /miniconda3/bin" >> /etc/profile.d/my_software.shsource /etc/profile.d/my_software.sh
docker
1 2 https://www.runoob.com/docker/ubuntu-docker-install.html
容器内常用软件安装,参见本文前半部分的常用软件安装
3 开发配置 C/C++
gcc-9/g++-9:由于Ubuntu22自带的gcc版本是11较高,为了兼容部分源码安装gcc-9以及g++-9
1 2 3 4 sudo apt install gcc-9 g++-9sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 20 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-9 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9
llvm-12.0.1(with gold plugin):插桩利器
1 2 curl https://gitee.com/QGrain/aflgo-build/raw/master/build_llvm_12.sh | bash
gdb
1 2 3 4 5 6 7 8 9 10 wget http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.xz tar xvJf gdb-10.2.tar.xzcd gdb-10.2sudo apt install -y python3-dev texinfo ./configure --with-python=/usr/bin/python3 make -j8sudo make install
1 2 3 4 5 6 7 8 9 wget -O ~/.gdbinit-gef.py -q https://gef.blah.cat/pyecho source ~/.gdbinit-gef.py >> ~/.gdbinit Python Exception <class 'UnicodeEncodeError' > 'ascii' codec can't encode character ' \u27a4' in position 12: ordinal not in range(128) # 在终端中设置正确的字符集以解决问题 echo "export LC_CTYPE=C.UTF-8" >> ~/.bashrc source ~/.bashrc
Java
Go
Rust
Node
4 CTF配置 Burpsuite Pro 2022 IDA Pro 7.7 更多详见百度网盘
To be completed