The Perfect Setup:
Ubuntu Server 8.04.1 LTS Hardy (supported to 2013) + EngineX (NGINX) Web Server built from sources + MySQL 5 + PHP 5.
(Or LEMP )
Tested on 256MB VPS slice at SliceHost. Should work for other hardware.
From baremetal/barebone/empty fresh install of Ubuntu Server to shiny, fast and SEO-friendly WordPress Portal propelled by WP Super Cache plugin.
All configured and powered by NGinx WEB Server.
Step by step copy/paste instructions – from "zero to hero" with everything on a single page (albeit long one) and in the right order. Just what your granma was asking for!
Every time I need to quickly utilize new product or technology it always made me wonder "why don’t someone came up with a simple step by step instructions on which buttons to press to make this thing work?". So instead of waiting for someone to do it this time I decided to make one myself.
After spending countless hours and days hunting for scripts, searching for clues, scrolling through misleading posts, extracting bits from articles, eliminating blubber and fluff, bugging busy geeky people for hints and getting all necessary pieces together in the right order I finally came up with this instructional post. It all boils down to step-by-step copy/paste instructions that should take you less than 1 hour to get from freshly installed Ubunty server to fully functioning, search engine optimized business-ready WordPress-powered website.
I tested it all on 256MB VPS image offered by SliceHost but the same instructions should work just just fine on any real hardware as well.
Most credits goes to excellent set of articles by PickedOnion at SliceHost plus to some more sources, acknowledged within this post.
This article assumes your username is ‘jsmith’ and your domain is ‘mydomain.com’.
Now it’s time to get our hands dirty!
Secure and tidy-up your fresh Ubuntu Server installation
- Login as root.
- Change root password:
- Add new username – yourself:
- Append this line to end of file (to navigate within ‘vi’ editor to create next line – use these: L, $, a, <ENTER>):
jsmith ALL=(ALL) ALL
To save and exit do: <ESC>, :wq, <ENTER>
- SSH configuration:
nano /etc/ssh/sshd_config – Find
Port 22 – and change number to something different (12345) to make hacking more difficult.
– Set these to:
– Append these lines to the very end:
- Secure slice with iptables
iptables-save > /etc/iptables.up.rules
- 1. Copy contents of this file -> and paste it into ‘iptables.test.rules’.
2. Change port number to your port number on this line:
-A INPUT -p tcp -m state –state NEW –dport 30000 -j ACCEPT
3. Save and exit (Ctrl+O, Ctrl+X).
- Apply new iptables rules:
iptables-restore < /etc/iptables.test.rules
- Save iptables rules permanently:
iptables-save > /etc/iptables.up.rules
- Make sure iptables rules will apply when server is rebooted as well:
- Add new line after these 2:
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.up.rules
Save and exit.
- Reload SSH to use new ports and configurations:
- Keep ‘root’ session running and open second session.
SSH login to your slice to new port, with your new username and password:
– Linux: ssh -p 12345 firstname.lastname@example.org – Windows: putty email@example.com 12345
- If you logged on successfully via your new username: ‘jsmith’ – you may close ‘root’ session now.
If not – you still have ‘root’ session opened to fix problems. In the worst case – you can use web based console shell login from your manage.slicehost.com dashboard to fix issues.
sudo aptitude -y install screen
- Enter screen:
screen Screen is the great little utility that allows your terminal session activity to keep running (say lengthy builds) even if you were cut off or disconnected. You may reenter your abandoned screen session at a later time to check progress and continue working.
– Usage notes:
– new screen session: screen
– attach to existing screen session: screen -r
– list all existing screen sessions: screen -list (output: 12045.pts-0.MENSK (Detached), etc…)
– attach to existing screen session by number: screen -r 12045
– detach from screen session and back to main terminal: Ctrl+A, D
– to rename screen session from inside of it: Ctrl+A, Shift+A – and enter it’s name.
– to kill current screen session: exit or Ctrl+A
– to kill all screen sessions: Ctrl+A,
- Edit .bashrc file to make terminal window a bit more helpful:
- Append these lines to the end of it: