-
-
Save shouya/0b007e7941dea6d3b116 to your computer and use it in GitHub Desktop.
vps setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/gentoo.sh && sh gentoo.sh | |
wget https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/ubuntu.sh && sh ubuntu.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g default-terminal "xterm-256color" | |
set-option -g prefix M-n | |
set-window-option -g mode-keys emacs | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
bind M-n send-prefix | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "updating system" | |
emerge --sync | |
emerge -1 portage | |
emerge --deep --update -v @world | |
echo "setting up user" | |
useradd -m -U -s /bin/bash shou | |
usermod -p PpbbebqBxDHWI shou | |
echo "configuring user login" | |
echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO4yc+C/w379hDQghCHPS/i9Qbfbj96VGJTiY49ED8A1arJ65rMEmELJ+8sXU0Seq1Q670209fzGWbtRnYmr3GNvO5ZBCWljkaopdeGEurOhWnkL57OvSH4pibLDKG+sxt48dBpUdPN6SKsRBChFeFhn2Uk/xsRN8x9bRi905ATR+s1ZsgbWfQwPGB+oXW8GbOw5+7z1BTWWk+MoxruU5fQV9M0IjBl7IG6qhLkrE5PaET+q1hXMR8sZ7yTzWUlwZWawRGFE8HmNCj6jrbcyN1ZFEvWUwl24GouNv/0mgMFHP10DSNzSda0rdorvv3nN5F1g3OLS61lwnJm0kUJv7B [email protected] > ~shou/.ssh/authorized_keys | |
chmod 600 ~shou/.ssh/authorized_keys | |
chown shou:shou ~shou/.ssh/authorized_keys | |
echo "configuring sudo" | |
emerge -v sudo | |
groupadd -r -f sudo | |
sed -i 's/# %sudo/%sudo/' /etc/sudoers | |
usermod -a -G sudo shou | |
echo "disabling ssh password login" | |
usermod -p $(openssl passwd -crypt $(openssl rand -base64 6)) root | |
echo 'ChallengeResponseAuthentication no' >> /etc/ssh/sshd_config | |
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config | |
echo 'UsePAM no' >> /etc/ssh/sshd_config | |
# echo 'RUBY_TARGETS="ruby20 ruby22"' >> /etc/portage/make.conf | |
echo "installing utilities" | |
emerge -v git emacs vim net-misc/curl mosh tmux htop docker | |
curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
echo "configuring tools" | |
sudo -u shou curl -L# -o ~shou/.tmux.conf https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/.tmux.conf | |
sudo -u shou mkdir -p ~shou/.config/htop | |
sudo -u shou curl -L# -o ~shou/.config/htop/htoprc https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/htoprc | |
/etc/init.d/ssh restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Beware! This file is rewritten by htop when settings are changed in the interface. | |
# The parser is also very primitive, and not human-friendly. | |
fields=0 48 3 18 38 39 40 2 46 47 49 37 1 | |
sort_key=46 | |
sort_direction=1 | |
hide_threads=1 | |
hide_kernel_threads=1 | |
hide_userland_threads=1 | |
shadow_other_users=0 | |
show_thread_names=0 | |
highlight_base_name=1 | |
highlight_megabytes=1 | |
highlight_threads=1 | |
tree_view=0 | |
header_margin=1 | |
detailed_cpu_time=0 | |
cpu_count_from_zero=1 | |
update_process_names=0 | |
account_guest_in_cpu_meter=0 | |
color_scheme=2 | |
delay=15 | |
left_meters=LeftCPUs2 RightCPUs2 CPU | |
left_meter_modes=1 1 3 | |
right_meters=LoadAverage Uptime Battery Memory Tasks | |
right_meter_modes=2 2 2 1 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME=shou | |
HOSTNAME=meidono1 | |
SSH_PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO4yc+C/w379hDQghCHPS/i9Qbfbj96VGJTiY49ED8A1arJ65rMEmELJ+8sXU0Seq1Q670209fzGWbtRnYmr3GNvO5ZBCWljkaopdeGEurOhWnkL57OvSH4pibLDKG+sxt48dBpUdPN6SKsRBChFeFhn2Uk/xsRN8x9bRi905ATR+s1ZsgbWfQwPGB+oXW8GbOw5+7z1BTWWk+MoxruU5fQV9M0IjBl7IG6qhLkrE5PaET+q1hXMR8sZ7yTzWUlwZWawRGFE8HmNCj6jrbcyN1ZFEvWUwl24GouNv/0mgMFHP10DSNzSda0rdorvv3nN5F1g3OLS61lwnJm0kUJv7B [email protected]" | |
SOFTWARE="emacs vim curl mosh tmux htop docker docker.io sudo build-essential ruby ruby-dev ghc" | |
echo "updating source" | |
apt-get update | |
echo "setting up system" | |
echo ${HOSTNAME} > /etc/hostname | |
echo 127.0.0.1 ${HOSTNAME} > /etc/hosts | |
echo "setting up user" | |
useradd -m -U -s /bin/bash ${USERNAME} | |
usermod -p PpbbebqBxDHWI ${USERNAME} | |
usermod -a -G sudo ${USERNAME} | |
echo "configuring user login" | |
mkdir -p /home/${USERNAME}/.ssh && chmod 700 /home/${USERNAME}/.ssh && chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.ssh | |
echo "${SSH_PUBKEY}" > /home/${USERNAME}/.ssh/authorized_keys | |
chmod 600 /home/${USERNAME}/.ssh/authorized_keys | |
chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.ssh/authorized_keys | |
echo "disabling ssh password login" | |
usermod -p $(openssl passwd -crypt $(openssl rand -base64 6)) root | |
echo 'ChallengeResponseAuthentication no' >> /etc/ssh/sshd_config | |
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config | |
echo 'UsePAM no' >> /etc/ssh/sshd_config | |
service ssh restart | |
echo "installing utilities" | |
apt-get install -y ${SOFTWARE} | |
echo "configuring tools" | |
sudo -u ${USERNAME} curl -L# -o /home/${USERNAME}/.tmux.conf https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/.tmux.conf | |
sudo -u ${USERNAME} mkdir -p /home/${USERNAME}/.config/htop | |
sudo -u ${USERNAME} curl -L# -o /home/${USERNAME}/.config/htop/htoprc https://gist.githubusercontent.com/shouya/0b007e7941dea6d3b116/raw/htoprc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment