Arch on UEFI

UEFI boot is weird, mostly because of backwards compatibility. Here’s a simple guide to setting up UEFI on GPT, assuming you already know how to do a typical Arch install.

Partitions

Gdisk supports GPT, so we’ll use that to partition our system disk.

gdisk /dev/sda

Press o to create a new GPT partition table, overwriting any existing contents.

Then, use n to create new partitions:

  • Root partition (8300), full disk size - 1.5 GB.
  • EFI partition (EF00), 1024 MB

Type p to output your new partition layout, and w to write the changes.

Finally, refresh the disks.

partprobe

Filesystems

Create filesystems for the new partitions:

mkfs.ext4 /dev/sda1
mkfs.fat -F32 /dev/sda2

Mount the new filesystems

mount /dev/sda1 /mnt
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot

Bootloader

First, mount efivarfs if not already mounted:

mount -t efivarfs efivarfs /sys/firmware/efi/efivars

We’ll use systemd-boot, as it’s included within systemd.

bootctl install

We’ll need to write a few new config files in /boot/loader:

vim /boot/loader/loader.conf
default arch
timeout 3
editor  0
vim /boot/loader/entries/arch.conf
title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options root=/dev/sda1 rw

Finishing Up

exit # ^D is always superior :P
umount -R /mnt
reboot

Workflow

Over the last few years, I’ve worked on an open source project management system called Phproject. It’s on GitHub under a GPL license, and you should use it.

Apparently I did a good enough job of it that someone tried to sell it. A Slovakian team going by the name KreaHive rebranded it as “Workflow”, and posted it to CodeCanyon. Apparently it was removed from the site quite quickly as I never saw it active, but I found it quite funny. After a bit more research, they have a public revision history that perfectly matches my latest updates on RevCTRL, and even made it to a business software review site, Capterra.

Workflow on Code Canyon

Then it got even better. I found a supposedly “nulled” version of Workflow on a site called Guest Post. Sadly the download links just redirect you back to the Code Canyon site, I would’ve loved to see what code changes were made in a nulled version of a stolen version of my open source project. At least they linked to a neat marketing graphic for it.

xinput

So I just discovered xinput. It’s neat.

Say you want to reduce the sensitivity on your mouse because it’s one of the stupid Mamba 2012s that are only usable with the buggy Windows software.

xinput list # lists input devices - note the ID of your device, we'll use '8'
xinput list-props 8
xinput 8 "Device Accel Constant Deceleration" 3

Arch Web Server

When a LAMP server just isn’t enough, you may as well go all-out with nginx, HHVM, and MariaDB on Arch Linux.

Start by installing and enabling the services:

sudo pacman -S nginx hhvm mariadb
sudo systemctl enable nginx
sudo systemctl enable hhvm
sudo systemctl enable mysqld

Run the initial setup for MariaDB:

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Create a new file /etc/nginx/hhvm.conf:

location ~ \.php$ {
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME $request_filename;
  include        fastcgi.conf;
}

Add a line to any nginx servers that need PHP:

include hhvm.conf;

After your MariaDB and nginx are configured, start your services:

sudo systemctl start nginx
sudo systemctl start hhvm
sudo systemctl start mysqld

Now you should be good to go!

LAMP Sever Setup

Sometimes you have a fancy VPS when you really just want a web server. This guide goes through the process of setting up a basic LAMP server with WordPress on Ubuntu.

LAMP Setup

To start out, you’ll need to install some packages. This step will ask you to create a database password, you should pick something secure that you can remember.

sudo apt-get install apache2 php5 php5-gd php5-mysql mysql-server-5.6 wget

After installing your packages, enable the rewrite module for pretty URLs in WordPress and other apps that use it.

sudo a2enmod rewrite

You should then edit your Apache configuration file. You’ll need to change the AllowOverride None line in the <Directory /var/www> block from None to All in order for .htaccess files to work properly.

sudo nano /etc/apache2/apache2.conf

Finally, restart Apache to apply your new configuration.

sudo service apache2 restart

WordPress Setup

Installing WordPress follows a pretty typical process that should work for most web apps and custom sites. We’ll start by creating a database. Run the command below, entering your database password chosen during the package installation.

mysql -uroot -p

Once in the MySQL command line, we’ll create a new database and user. Replace “Passw0rd” with a secure password. You’ll use this username (“wordpress”) and password to install WordPress later.

CREATE DATABASE `wordpress`;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'Passw0rd';
GRANT ALL ON `wordpress`.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
\q

After creating a database, we’ll download and unzip WordPress.

cd /var/www
sudo wget https://wordpress.org/latest.zip
sudo unzip latest.zip
sudo chown -R www-data: wordpress
sudo chmod -R 755 wordpress

We need to tell Apache to run our WordPress code, so next we’ll create a new VirtualHost.

sudo nano /etc/apache2/sites-available/wordpress.conf

Enter the following text in the new file, replacing example.com with your domain (you should point the domain to the server’s IP address as well):

<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/wordpress
</VirtualHost>

If you want additional domains or subdomains to point to this website as well, you can add a ServerAlias line after ServerName, like this:

ServerAlias www.example.com example.org

Now that your VirtualHost is created, enable it and reload Apache.

sudo a2ensite wordpress
sudo service apache2 reload

At this point, if your domain is set up correctly, you should be able to browse to your website and install WordPress. You’ll need the database username and password you set up earlier, and the database hostname should be localhost.

Once installed, you should go into WordPress’s admin panel and change the Permalink style (Settings > Permalinks) to something other than the default to take advantage of Apache’s URL rewrites.