CPP 基于Ubuntu 20.04搭建C系列开发环境
1、SSH连接ECS
ssh root@ip -p
2、修改主机名
vim /etc/hostname
reboot
3、设置新用户
adduser linyuqi
usermod -G sudo linyuqi
reboot
4、配置SSHD
以下操作均在新用户,添加配置信息:
sudo vim /etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3
sudo service sshd restart
5、Github优化
5.1 查看IP(2个)
IP地址查看:前往查看
5.2 配置IP
sudo vim /etc/hosts
199.232.69.194 github.global.ssl.fastly.net
140.82.112.3 github.com
6、配置Vim
sudo apt update -y
sudo apt install git -y
wget 47.93.11.51:88/install_vim.sh
bash install_vim.sh
7、配置zsh
7.1 安装zsh
sudo apt install zsh -y
7.2 设置默认
chsh -s /bin/zsh
7.3 安装oh-my-zsh
7.3.1 网络安装
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
7.3.2 脚本安装
wget 47.93.11.51:88/install_zsh.sh
bash install_zsh.sh
7.4 安装zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
7.5 配置zsh-syntax-highlighting
vim .zshrc
plugins=(git zsh-syntax-highlighting)
7.6 安装其他插件
##命令自动补全插件
mkdir ~/.oh-my-zsh/plugins/incr
wget http://mimosa-pudica.net/src/incr-0.2.zsh -O ~/.oh-my-zsh/plugins/incr/incr.plugin.zsh
##命令自动推荐,根据历史记录
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
##目录自动跳转插件
sudo apt install autojump -y
7.7 配置插件
vim .zshrc
#设置终端颜色,提示符,及上一条指令返回码提示
autoload -U colors && colors
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%1~ %{$reset_color%}%# "
RPROMPT="[%{$fg[yellow]%}%?%{$reset_color%}]"
# Useful support for interacting with Terminal.app or other terminal programs
[ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM"
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
source /usr/share/autojump/autojump.sh
source ~/.oh-my-zsh/plugins/incr/incr*.zsh
8、配置ctags
8.1 安装ctags
sudo apt install ctags -y
8.2 配置命令
ctags -I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__ --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/systags /usr/include/* /usr/include/x86_64-linux-gnu/sys/* /usr/include/x86_64-linux-gnu/bits/* /usr/include/arpa/*
8.3 配置命令
vim .vimrc
set tags+=~/.vim/systags
9、安装glibc-doc
sudo apt install glibc-doc -y
10、安装tldr
sudo apt install tldr -y