Mar. 10, 2015

Archlinux in Virtualbox

Install Arch Linux in Virtualbox Pre-installation Partition the disks $ fdisk /dev/sda boot > n > return (default primary) > return (default partition 1) > return (default first sector) > +250M swap > n > return (default primary) > return (default partition 2) > return (default first sector) > +2G / > n > return (default primary) > return (default partition 3) > return (default first sector) > +2G > return /home > n > p (make primary) > return (default first sector) > return (default last sector) make /dev/sda1 bootable > a > 1 make /dev/sda1 to swap type partition > t > 2 > 82 write table to disk and exit fdisk > w Format the partitions format partitions $ mkfs.ext4 /dev/sda1 $ mkfs.ext4 /dev/sda3 $ mkfs.ext4 /dev/sda4 make swap $ mkswap /dev/sda2 mount swap $ swapon /dev/sda2 Mount the partitions $ mount /dev/sda3 /mnt $ cd /mnt $ mkdir boot home $ mount /dev/sda1 boot $ mount /dev/sda4 home $ cd / Installation Select the mirrors rankmirrors to make this faster (though it takes a while) mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig rankmirrors -n 6 /etc/pacman.d/mirrorlist.orig \>/etc/pacman.d/mirrorlist pacman -Syy Install the base packages # install base packages (take a coffee break if you have slow internet) pacstrap /mnt base base-devel Configure the system Generate an fstab file $ genfstab -p /mnt >> /mnt/etc/fstab Change root into the new system $ arch-chroot /mnt Set the hostname $ echo [archlinux] > /etc/hostname Set the time zone

Sep. 24, 2014

Install Ghost with Nginx and MySQL

The steps I installed Ghost blog on Linode with Debian 7.5 Prepare apt-get update apt-get upgrade apt-get install -y build-essential Installing Nginx apt-get install nginx Install Node.js Based on here Setup with Debian (as root): curl -sL | sudo bash - Then install with Debian (as root): apt-get install -y nodejs nodejs-legacy Install MySQL apt-get install mysql-client mysql-server Secure MySQL mysql_secure_installation Restart MySQL /etc/init.d/mysql restart or service mysql restart Using MySQL mysql -u root -p to setup database: CREATE DATABASE YOUR_DATABASE; CREATE USER 'YOUR_USERNAME' IDENTIFIED BY 'YOUR_PASSWORD'; GRANT ALL PRIVILEGES ON YOUR_DATABASE.* TO 'YOUR_USERNAME'; exit Install Ghost Based on here created /var/www/ghost as ghost folder mkdir -p /var/www/ cd /var/www/ curl -L -o unzip -uo -d ghost cd /var/www/ghost Then setup ghost environment npm install --production npm install mysql npm install forever -g Setup Ghost Copy over the example config file and then edit it cp config.example.js config.js vim /var/www/ghost/config.js Change production default url to your domain and setup MySQL database url: 'http://YOUR_DOMAIN', database: { client: 'mysql', connection: { host: 'localhost', user: 'YOUR_USERNAME', password: 'YOUR_PASSWORD', database: 'YOUR_DATABASE', charset: 'utf8' } }, Run Ghost as background process Fix all permission chown -R www-data:www-data /var/www/ghost Then run ghost as background process by forever (you can find other deply methods in here) NODE_ENV=production forever start index.js Setup Nginx vim /etc/nginx/sites-available/ghost server { listen 80; server_name; location / { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.