Skip to content

Instantly share code, notes, and snippets.

@nofxx
Created June 29, 2015 21:00
Show Gist options
  • Save nofxx/2b1c2f6acaa1a50396f4 to your computer and use it in GitHub Desktop.
Save nofxx/2b1c2f6acaa1a50396f4 to your computer and use it in GitHub Desktop.
Archlinux Rise
# Pkgs on servers:
# ----------------
# 1 - Setup disks
# 2 - Change vars:
app="niceapp"
name="aakira"
sshkey="ssh-rsa..."
# 3 - GO
# Install
pacman -R man-db --noconfirm
pacman -S archlinux-keyring --noconfirm
pacman-key --init && pacman-key --populate
pacman -S pacman --noconfirm
pacman-db-upgrade
pacman -Syu --noconfirm
pacman -Sy --noconfirm ntp syslog-ng base-devel ruby git nodejs zsh \
libxslt imagemagick geoip inetutils iptables netctl htop nginx iotop \
libxml2 libpng sudo lsof strace librsvg tree tmux wget cmake net-tools \
gzip p7zip zip unzip postgresql rethinkdb mongodb redis hiredis memcached
# ghostscript opencv tesseract/ *OPT
# Root/Deployer
mkdir ~/.ssh
chmod 700 ~/.ssh
echo $key > ~/.ssh/authorized_keys
useradd deployer
passwd -l deployer
# SSH
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/#Port 22/Port 22223/g' /etc/ssh/sshd_config
systemctl daemon-reload
systemctl restart sshd
# /srv
mkdir /srv/$app
chown deployer:deployer /srv/$app
usermod -d /srv/$app deployer
mkdir /srv/$app/.ssh
chmod 700 /srv/$app/.ssh
echo $key > /srv/$app/.ssh/authorized_keys
ssh-keygen -N '' -f /srv/$app/.ssh/id_rsa
chown -R deployer:deployer /srv/$app/
cat /srv/$app/.ssh/id_rsa.pub
# /etc
echo $name > /etc/hostname
rm /etc/localtime
ln -s /usr/share/zoneinfo/Brazil/East /etc/localtime
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "gem: --no-rdoc --no-ri" > /etc/gemrc
gem update && gem install bundler god
systemctl enable iptables
systemctl enable ntpd
# var/lib
disk="sdc"
mount /dev/$disk /mnt
cp -ar /var/lib/* /mnt/
umount /mnt
mv /var/lib /var/libold
mkdir /var/lib
echo "/dev/$disk /var/lib ext4 noatime,errors=remount-ro 0 1" >> /etc/fstab
mount /var/lib
# fstab
# /dev/sda / ext4 noatime,errors=remount-ro 0 1
# /dev/sdb none swap sw 0 0
# /dev/sdc /tmp ext4 noatime,errors=remount-ro 0 1
# /dev/sdd /var/lib ext4 noatime,errors=remount-ro 0 1
# /dev/sde /var/log ext4 noatime,errors=remount-ro 0 1
#
#
#
# EXTRA
#
#
# yaourt
domain = 'foo.com'
server = $name + $domain
scp appkey.rsa appkey.pub deployer@$server ~/.ssh/
# destination xlog { tcp("l.fireho.com"); };
# log { source(src); destination(xlog); };
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar zxvf package-query.tar.gz
cd package-query
makepkg -si
cd ..
curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
tar zxvf yaourt.tar.gz
cd yaourt
makepkg -si
cd ..
systemctl enable mongodb
systemctl enable redis
systemctl enable memcached
systemctl enable nginx
systemctl enable unicorn
systemctl enable sidekiq
# iptables !!!!
# pg
initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment