Skip to content

Instantly share code, notes, and snippets.

@DanielTimLee
Last active February 9, 2019 17:20
Show Gist options
  • Save DanielTimLee/5dd03d176f1b7142f75908996c84d82a to your computer and use it in GitHub Desktop.
Save DanielTimLee/5dd03d176f1b7142f75908996c84d82a to your computer and use it in GitHub Desktop.
Linux Scripts
Linux Scripts
Package Manager with pacapt
Cron Build by Travis
Automatic Daily Cron Build by Travis
# https://github.com/PapirusDevelopmentTeam/arc-kde
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install-arc-kde-root.sh | sh
sudo pacman -S kvantum-qt5 --noconfirm
sudo pacman -S papirus-icon-theme --noconfirm
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install-papirus-root.sh | sh
# Run kvantummanager to choose and apply Arc Darker (or any other Arc) theme.
DEFAULT_OPT='--noconfirm --m-arg --skipchecksums --m-arg --skippgpcheck'
sudo pacman -Syu
sudo pacman -S sudo vi zsh wget fuse git vim xorg xorg-xinit kf5 kf5-aids plasma kdebase spectacle gwenview ttf-freefont sddm sddm-kcm gtk-engines gtk2 gtk3 gnome-themes-standard gnome-icon-theme ntp networkmanager net-tools alsa-utils pulseaudio pulseaudio-alsa libcanberra-pulse libcanberra-gstreamer jack2-dbus --noconfirm
sudo systemctl enable sddm
sudo systemctl enable ntpd
sudo systemctl enable NetworkManager dhcpcd
##### SDDM Theme Setting /etc/sddm.conf
# [Theme]
# Current=breeze
# CursorTheme=breeze_cursors
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si --noconfirm
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si --noconfirm
cd ..
# Install AUR (Aura-bin)
yaourt -S aura-bin --noconfirm
touch ~/.exportrc
echo "alias pacman='sudo aura'" >> ~/.exportrc
https://github.com/spoqa/spoqa-han-sans/releases/download/2.1.1/SpoqaHanSans_all.zip
# autoenv
git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
echo 'source ~/.autoenv/activate.sh' >> ~/.exportrc
# ultimate vimrc
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
echo "source ~/.exportrc" >> ~/.bashrc
# Apple Intel Only driver. KDE Resolution Fix.
sudo pacman -S xf86-video-intel --noconfirm
# Apple Keyboard Tilde Key.
sudo touch /etc/modprobe.d/hid_apple.conf
echo 'options hid_apple iso_layout=0' | sudo tee --append /etc/modprobe.d/hid_apple.conf
# KDE Hangul Input Method. (Fcitx)
sudo pacman -S fcitx-hangul kcm-fcitx fcitx-gtk2 fcitx-gtk3 fcitx-qt4 fcitx-qt5 --noconfirm
# Must Edit .xprofile with IM module
touch ~/.xprofile
echo "export GTK_IM_MODULE=fcitx" >> ~/.xprofile
echo "export QT_IM_MODULE=fcitx" >> ~/.xprofile
echo "export XMODIFIERS=@im=fcitx" >> ~/.xprofile
sudo pacman -S ark p7zip zip unzip unrar wxgtk --noconfirm
# Bluetooth
sudo pacman -S bluez bluez-libs bluez-utils pulseaudio-bluetooth rfkill --noconfirm
sudo modprobe btusb
sudo rfkill unblock bluetooth
sudo systemctl enable bluetooth
sudo systemctl start bluetooth
# Utilities
sudo pacman -S systemd-kcm atom nodejs npm yarn openssh fail2ban sshfs kdeconnect --noconfirm
yaourt -S gitkraken --noconfirm --m-arg --skipchecksums --m-arg --skippgpcheck
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
# Personal Information Manage
# sudo pacman -S korganizer kmail kontact kaccounts-integration kaccounts-providers --noconfirm
# Fonts.
sudo pacman -S ttf-bitstream-vera ttf-inconsolata ttf-ubuntu-font-family ttf-dejavu ttf-freefont ttf-linux-libertine ttf-liberation --noconfirm
sudo pacman -S adobe-source-han-sans-kr-fonts adobe-source-han-serif-kr-fonts ttf-baekmuk --noconfirm
# https://askubuntu.com/questions/228561/install-many-fonts-at-once
wget https://github.com/spoqa/spoqa-han-sans/releases/download/2.1.1/SpoqaHanSans_all.zip
unzip SpoqaHanSans_all.zip -d ~/.fonts
yaourt -S ttf-nanum ttf-nanumgothic_coding --noconfirm --m-arg --skipchecksums --m-arg --skippgpcheck
yaourt -S otf-ipafont ttf-amiri ttf-ancient-fonts ttf-ms-fonts ttf-monaco ttf-noto ttf-vista-fonts --noconfirm --m-arg --skipchecksums --m-arg --skippgpcheck
fc-cache -rv
sudo aura -A google-chrome sublime-text-dev-imfix-fcitx jetbrains-toolbox slack-desktop cutemarked --noconfirm
pacman -R konqueror --noconfirm
#WPS Office Installation
sudo mkdir /root/.config
sudo aura -A wps-office ttf-wps-fonts --noconfirm
sudo rm /usr/share/mime/packages/wps-office-*
sudo update-mime-database /usr/share/mime
# PowerLine Fonts clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
# https://unix.stackexchange.com/questions/13751/kernel-inotify-watch-limit-reached
sudo touch /etc/sysctl.d/40-max-user-watches.conf
echo 'fs.inotify.max_user_watches=524288' | sudo tee --append /etc/sysctl.d/40-max-user-watches.conf
sudo sysctl --system
pip install virtualenv
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# POTD https://www.reddit.com/r/kde/comments/711lej/picture_of_the_day_lock_screen_background_not/
ln -s $HOME/.cache/plasmashell/plasma_engine_potd $HOME/.cache/kscreenlocker_greet/plasma_engine_potd
echo "source ~/.exportrc" >> ~/.zshrc
export NICKNAME=${1:-host}
sudo bash -c "echo 'export NICKNAME=$NICKNAME' > /etc/profile.d/prompt.sh"
sudo sed -i -e 's|\\u@\\h \\W|\\u@$NICKNAME \\W|' /etc/bashrc
PROMPT_TERM=/etc/sysconfig/bash-prompt-xterm
sudo touch $PROMPT_TERM
sudo chmod +x $PROMPT_TERM
sudo bash -c "echo '' >> $PROMPT_TERM"
sudo sed -i '1iecho -ne "\\033]0;${USER}@${NICKNAME}:${PWD/#$HOME/~}\\007"' $PROMPT_TERM
# Work in only Gist
bash oh-my-zsh.sh
bash vimrc_ultimate.sh
bash docker_psFormat.sh
apt-get update
apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-nginx -y
# certbot --authenticator webroot --installer nginx
certbot --authenticator standalone --installer nginx --pre-hook "nginx -s stop" --post-hook "nginx"
# https://container42.com/2016/03/27/docker-quicktip-7-psformat/
if $(which pacapt > /dev/null ); then
mkdir ~/.docker
touch ~/.docker/config.json
echo '{"psFormat": "table {{.Names}}\\t{{.Status}}\\t{{.ID}}\\t{{.Ports}}"}' >> ~/.docker/config.json
fi
#!/bin/bash
apt-get install -y curl unzip
mkdir -p /var/lib/consul
mkdir -p /usr/share/consul
mkdir -p /etc/consul/conf.d
curl -OL https://releases.hashicorp.com/consul/1.2.1/consul_1.2.1_linux_amd64.zip
unzip consul_0.7.5_linux_amd64.zip
mv consul /usr/local/bin/consul
curl -OL https://releases.hashicorp.com/consul/1.2.1/consul_1.2.1_web_ui.zip
unzip consul_0.7.5_web_ui.zip -d dist
mv dist /usr/share/consul/ui
#!/bin/bash
# https://askubuntu.com/q/95910
curl ipinfo.io
# curl -s ipinfo.io | jq -r '.country'
# For country code
if ! $(which pacapt > /dev/null ); then
sudo bash -c "$(curl -fsSL https://git.io/vbRDX)";
fi
sudo pacapt --noconfirm -S zsh git
sudo chsh -s $(which zsh) $USER
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#!/usr/bin/env bash
# Run with sudo.
# Will not run in sh (Bourne Shell) due to -- double dash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
PM=pacapt NC=--noconfirm
OS=$(cat /etc/os-release 2>/dev/null | grep "^NAME" | sed -e 's/NAME=//;s/\"//g')
if [[ $OS == "Arch Linux" || $OS = *"Manjaro"* ]]; then
ln -sv /usr/bin/pacman /usr/bin/pacapt || true
else
curl -Lo /usr/bin/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
chmod 755 /usr/bin/pacapt
ln -sv /usr/bin/pacapt /usr/bin/pacman || true
fi
START=$SECONDS
$PM $NC -Sy
ELAPSED=$(($SECONDS - $START))
MAX_TIME=25
if $(command -v apt-get > /dev/null ); then
if [[ "$ELAPSED" -gt "$MAX_TIME" ]]; then
CODE=$(curl -s ipinfo.io/country || echo "KR")
HTTP=http:\/\/ MIRROR=mirror:\/\/
sed -i -E -e 's/security|archive/mirrors/g' /etc/apt/sources.list
sed -i -e "s|$HTTP|$MIRROR|g" -e "s|\/ubuntu\/|\/$CODE.txt|g" /etc/apt/sources.list
fi
elif $(command -v yum > /dev/null ); then
$PM $NC -S epel-release
elif $(command -v zypper > /dev/null ); then
#https://unix.stackexchange.com/q/82016
zypper addrepo http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ packman | echo 'a'
fi
echo "Pacapt Installation Complete! Enjoy!"
# Run with Sudo!
bash -c "$(curl -fsSL https://git.io/vbRDX)"
apt-get update
apt-get install vim tmux htop wget curl ufw jq -y
ufw allow 'OpenSSH'
# Jenkins
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
apt-get update
apt-get install jenkins -y
systemctl enable jenkins
systemctl start jenkins
# https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-16-04
# ufw allow 8080
# Nginx
apt-get install nginx -y
ufw allow 'Nginx FULL'
# mysql
apt-get install mysql-server -y
mysql_secure_installation
systemctl enable mysql
systemctl start mysql
# check before submodule inited.
git submodule update --recursive --remote
FOUND: http://ftp.tu-chemnitz.de/pub/linux/ubuntu-ports/
FOUND: http://archive.mirror.blix.com/ubuntu/
FOUND: http://mirror.vorboss.net/ubuntu-archive/
FOUND: http://mirror.veracruz.co/ubuntu/
http://mirrors.ustc.edu.cn/ubuntu-ports/
if ! $(which pacapt > /dev/null ); then
sudo bash -c "$(curl -fsSL https://git.io/vbRDX)";
fi
sudo pacapt --noconfirm -S vim git
git clone https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
@DanielTimLee
Copy link
Author

sudo chsh -s $(which zsh) $USER
must changed to sudo su; and execute chsh

@DanielTimLee
Copy link
Author

[Pritunl] Mongodb install from archive

pacman -U https://archive.archlinux.org/packages/w/wiredtiger/wiredtiger-3.1.0.20181203-1-x86_64.pkg.tar.xz
pacman -U  https://archive.archlinux.org/packages/m/mongodb/mongodb-4.0.5-1-x86_64.pkg.tar.xz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment