Skip to content

Instantly share code, notes, and snippets.

@a-shevtsov
Last active September 9, 2020 19:30
Show Gist options
  • Save a-shevtsov/5bdcc375672b4a802c600a3aae048e07 to your computer and use it in GitHub Desktop.
Save a-shevtsov/5bdcc375672b4a802c600a3aae048e07 to your computer and use it in GitHub Desktop.
CentOS/RHEL 7 workstation set up
# Create .ssh directory and authorized_keys file
mkdir -m 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# Set/restore SELinux permissions on the authorized_keys file
sudo /sbin/restorecon -v ~/.ssh/authorized_keys
# Append the public key
# Enable additional YUM repos that have Ruby and Python 3
sudo yum install -y \
centos-release-scl-rh \
epel-release
# Install Ruby 2.3 (for Vim), Python 3 (for Vim), NeoVim, Midnight Commander, Go language and other tools
sudo yum install -y \
bats \
bind-utils \
expat-devel \
gcc \
gcc-c++ \
golang \
jq \
kernel-devel \
libcurl-devel \
lvm2 \
make \
mc \
ncurses-devel \
neovim \
openldap-clients \
openssl-devel \
python-setuptools \
python34 \
python34-setuptools \
rh-ruby23 \
rh-ruby23-ruby-devel \
telnet \
unzip
# Restore UTF-8 locale after installing glibc-common blows it away. https://github.com/CentOS/sig-cloud-instance-images/issues/71
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
## Install Git client
curl -sSOL https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar -xzf git-2.18.0.tar.gz
cd git-2.18.0
make prefix=/usr -j 2
sudo make prefix=/usr install
cd ..
rm -rf git-2.18.0*
## Install tmux. Credit goes to https://gist.github.com/philipsd6 (https://gist.github.com/philipsd6/9576d313d577b57dd7c351ac801317f2)
# Download sources for libevent. Run make and install
curl -sSOL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -xzf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/usr/local
make -j 2
sudo make install
cd ..
rm -rf libevent*
# Download sources for tmux. Run make and install
curl -sSOL https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
tar -xzf tmux-2.3.tar.gz
cd tmux-2.3
LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure
make -j 2
sudo make install
cd ..
rm -rf tmux*
# Install pip for Python 2 and Python 3
sudo easy_install-2.7 pip
sudo easy_install-3.4 pip
# Install NeoVim Python module (Vim-Python integration plugin)
pip2 install --user --upgrade neovim
pip3 install --user --upgrade neovim
# Install NeoVim Ruby gem (Vim-Ruby integration plugin)
export PATH=$PATH:/opt/rh/rh-ruby23/root/usr/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rh/rh-ruby23/root/usr/lib64
gem install neovim
# Install Vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# Create symlink from .vimrc to where NeoVim expects config file
mkdir -p ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
# Create .vimrc (use ':set nopaste' to insert text from the clipboard)
nvim .vimrc
# Reload .vimrc - ':so %'
# Install plugins - ':PluginInstall'
# Compile C extension for Command-T plugin (Vim)
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
ruby extconf.rb
make
cd ~
# Clone git prompt for Bash project
git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
# Download Git completion profile
curl -L https://github.com/git/git/raw/master/contrib/completion/git-completion.bash -o ~/.config/git-completion.bash
# Configure Git aliases
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.last 'log -1 HEAD'
git config --global alias.root 'rev-parse --show-toplevel'
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
alias vi=nvim
# Create .gitconfig
# Update .bashrc and then source it
source ~/.bashrc
# Update .bash_profile
# Create .tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment