The Blog of Tom Webster

Chronic Ranter, Reviewer, and Developer. I speak only for myself, opinions are my own.

Server-Bits #4: Apache and Wordpress

  2010-01-07 21:14:00 PST

In this tutorial, I'll walk you through how to get your server hosting webpages powered by Wordpress. Wordpress is the most powerful free blogging software suite out there. Powering everything from CNN and BBC blogs to 72pc.com [Shameless Plug], Wordpress is as easy as you want to make it, or as complex and extendable as you want it to be.

The first thing we need to do is install a web server and supporting server applications. Apache2 will serve up webpages, mySQL will contain the wordpress database and any posts you make, PHP will handle the web-side scripting needed by Wordpress.

For these commands, you should run these in a Bash shell, either via a terminal window or ssh.

  1. 'sudo apt-get install apache2 mysql-server-5.1 php5 php5-mysql'
  2. You should then make a password for the mySQL root user (The installer will automatically prompt you). Remeber: Passwords should be lengthy and complicated.
  3. 'wget http://wordpress.org/latest.tar.gz' - This will download the very latest build of Wordpress to your home directory.
  4. 'sudo mv latest.tar.gz /var/www' - This will move the tarball (This is essentially the linux equivalent of a zip file) to the directory /var/www.
  5. 'cd /var/www' - This will change your current directory to /var/www.
  6. 'sudo tar xvvf latest.tar.gz' - This will extract the contents of latest.tar.gz.
  7. 'sudo mysqlinstalldb' - This will install the database platform on your machine.
  8. 'sudo mysql -u root -p' - This will bring you to the mysql prompt logged in as root.
  9. 'CREATE DATABASE wordpress;' - This will create the wordpress database we will later use.
  10. 'CREATE USER [enter your own username here];' - Creates a database user with the name you specify. Remember this username!
  11. 'SET PASSWORD FOR [your username] = PASSWORD("[enter your own password here] ");' - This will set a password for the user you just created.
  12. 'GRANT ALL PRIVILEGES ON wordpress.* TO [your username]@localhost IDENTIFIED BY '_[enter your own password here] _';' - This will grant the user you just created privileges to do whatever he/she wants on the wordpress database.
  13. 'exit' - I think this command is self explanatory.
  14. Next, open up FireFox and, if you are on your server, go to http://localhost/wordpress/wp-admin/install.php, otherwise use http://your.domain.com/wordpress/wp-admin/install.php.
  15. The database name should be wordpress by default, so you shouldn't have to change this. Fill in your username and password (The one you created at the mySQL promp), you can leave the Database Host and Table Prefix at their default values.
  16. Log in with the randomly generated password, then change the admin password to something you will remember easier.
  17. For security purposes, you should create a new wordpress user and use that to post.
  18. To finish the install procedure, we need to change file permissons to be viewable externally. Run the command 'sudo chmod -R 755 /var/www/wordpress/'.
  19. In FireFox, navigate to http://localhost/wordpress/. You should see the front page of your blog pop up!

Now... Wordpress is one of the most extendible platforms on the web, you can re-theme it, add plugins and widgets, control how editors/authors/readers interact with your page, and a ton of other stuff.

For themes, go here, for plugins, here.

Now for the most important part: Content. Get to writing, building, posting, uploading content that people will care about. This is now a public facing web-server (As long as you have forwarded port 80), so get to building!

Thanks to Jonathan Moeller for parts of this guide!

_About Server-Bits:

If you've ever wanted to get started building a server, right in your own backyard, kitchen, closet, mother's closet, mother's basement, then this is the read for you. Aimed at the not-so-technical-but-willing-to-learn, this will give you everything you need to build... that monster-server you've dreamed of. My goal: To give you a working, rocking server, for free, that you can use daily.

Adventures in Adventure 3: The Museum of Science and Industry / McDonalds

  2010-01-05 17:37:00 PST

Well, we decided to head out to the Museum of Science and Industry, we took a ton of video, and I'll let that speak for itself:


We did head out to Chicago's Double-Decker McDonalds to grab some food before we headed back to Ohio:

I'm working on some quick editing of another video of us just driving through the city.

And that's about it for our Chicago adventure. I'm sure we'll be taking another trip up there sometime, but until then, enjoy those videos. Stay tuned for more Server-Bits, I'll be finishing up another one here soon.

Adventures in Adventure 2: Pizza, Tech, Cabbies, and The Blues

  2010-01-03 05:24:00 PST

First off: The trains in Chicago are wonderful. Cheap, easy, a much better option than finding parking (usually about $16-$20 bucks a day) on the street. Buses are pretty nice too. Public transit isn't the awful boon that most people make it out to be if managed correctly. A few hours in and we were planning routes around city blocks easily enough. The experience in this city makes me wish that there was more (and better managed) public transit in the US. We stopped by the Sears Tower (Now, The Willis Tower), and decided to take their Skybox tour. Here is the video there:

We also went to Gino's East of Chicago Pizza. THE Chicago Pizza Place. The food was less like Pizza and more like Soup. It was absolutely amazing. Rob and I couldn't even finish the small pizza we ordered. Gino's is officially the best pizza I have ever consumed.

We also traveled to the Museum of Technology and Industry (Video still pending, TONS of content), it wasn't the most comprehensive museum I've been to, but it had more than its fair share of "Good shit that was amazing." moments. Like I said, video still pending, but when it is up, I'll make sure to post it.

Totally forgot to talk about the Blues bar we went to! We hit up Buddy Guys Legends bar, great atmosphere, food was a good price, drink prices were through the roof, but it was a good time overall. The music selection was good, the guys on-stage were plenty talented, but we felt the music lacked feeling, like playing the Blues was more of their night job, just doing it to get by, they weren't really feeling the music they were playing. Other than that, a wonderful experience.

Side note: Cabbies like to take the long way around, unless you wanna get jacked an extra $.50, make sure you're riding with someone who knows their way around town (Thanks, Rob).

Adventures in Adventure 1: Chicago Arrival

  2010-01-02 08:47:00 PST

We are here in Chicago. We're staying in the Chicago South Loop Hotel, not the fanciest place around, but it more than serves its purpose as a sleep/shower joint. Right now we're online trying to figure out which pizza options are open to us at this time of night (1:52 AM).
New Info:

(2:23 AM) Apparently there is no such thing as authentic Chicago-style pizza past midnight.

Video of hotel room [coming soon]:

Server-Bits #3: Setting up SSH

  2009-12-29 14:58:00 PST

Now that you have a server built, the first thing we need to do is get SSH set up. SSH will allow you to remote control your computer from anywhere that has an internet connection. You will need to forward port 22 on your router if you want to hit it from the outside.

  1. Just a reminder: Make sure your user password is lengthy and complicated. *The last thing you want is for someone to waltz into your machine using the password 'password'. SSH will give an attacker *direct access to your entire machine. While it is an extremely useful tool, it can be utter hell if misued.
  2. Next, open up a terminal. The command you want is 'sudo apt-get install openssh-server'.
    Now wait patiently for the program to finish installing.

  3. If you'd like to test SSH, use the command 'ssh localhost', ssh should ask you if you would like to trust the server on the other end, then it should ask you for your password.

  4. You have just established an SSH connection to your server. Congrats.

  5. A few things to keep in mind about SSH: To give someone SSH access to your computer [Known as giving someone a Shell Account], you would create a new user as you would usually do (either through the GUI or the command 'adduser'), and they are automatically granted SSH access.

  6. To establish an ssh connection, you will need a Terminal Emulator, the most popular program for Windows is called PuTTY. On any Linux or Mac OSX machine, you can just open up a terminal and type 'ssh username@host.com' to connect (You will be using your DynDNS hostname). If your username was 'samurailink3' and your domain was 'google.com', you could use 'ssh samurailink3@google.com' to establish a connection.

Note: You don't have to use a domian, IP addresses work as well: 'ssh samurailink3@64.233.169.105'.

Cool things to try:

  1. On machines that are running an X-Server (Most any Linux machine), you can remotely display graphical applications with '-X': 'ssh -X samurailink3@google.com', then I can run 'firefox', and the instance of FireFox over at google.com will be displayed on this screen. Note: This is stupidly slow. Really really slow. But it is secure.
  2. SSH tunneling to secure otherwise insecure protocols (We will get into this in a later tutorial).
  3. SFTP: You can use most any FTP program (Such as FileZilla) to easily transfer files to and from the host machine [Just make sure to specify port 22!].
  4. If you want to set a pre-login banner to SSH, create a new text file [/etc/ssh/banner] and put any text you would like in that file, save, exit your text editor {Protip: You can use the command 'nano' to edit text in a terminal, you can then use Ctrl+X to exit to editor, answer yes or no to whether or not you would like to save. Example: 'nano /etc/ssh/banner'}. Now, edit your sshd config file [/etc/ssh/sshd_config] and add the line 'Banner /etc/ssh/banner'. Save and exit. Next time you attempt to log into SSH, you will be greeted by whatever text is in /etc/ssh/banner!
  5. If you would like to set a post-login message to SSH, (On Ubuntu 9.10), you must first disable update-motd. You can do this by running 'sudo update-motd --disable'. Then edit the text file [/etc/motd] to say whatever you want. When a user successfully logs into SSH, they will see whatever is in this text file.
  6. Remember: If you change any configuration, restart your SSH server with this command 'sudo /etc/init.d/ssh restart'. {Protip: Changing a configuration file for a service in Linux doesn't mean you have to restart your computer, that's the Windows way of thinking. The vast majority of the time, all you need to do is restart the service. These scripts are located in /etc/init.d/. We will cover them when the time is right.}

For now: Enjoy remote administration of your machine!

About Server-Bits:

If you've ever wanted to get started building a server, right in your own backyard, kitchen, closet, mother's closet, mother's basement, then this is the read for you. Aimed at the not-so-technical-but-willing-to-learn, this will give you everything you need to build... that monster-server you've dreamed of. My goal: To give you a working, rocking server, for free, that you can use daily.

Page: 28 of 32