So… you want have your voice on the internet.
The easiest way to do that is to host your site on one of the many web-hosting companies around…
… but that costs money and you will have learned nothing.
Having your own web-server eliminates the hosting costs and will give you total control over it’s content and behavior.
And we Slackers are big fans of total control.
Also, it’s a fun learning experience.
As I said before, this site is done with WordPress, which is a great tool for people (like me) who understand little or nothing about html, java and php.
We will now learn how to install WordPress on your very own server.
The first step, is to have installed and configured a LAMP server, which will serve as a back-end for our WordPress site.
First, create a new database and user so your future WordPress can store content.
mysql -u root -p # insert the mysql's root password and you'll go into the mysql prompt mysql> create database mysite; mysql> grant all privileges on mysite.* to mysite@"localhost" identified by 'somepassword'; mysql> fush privileges; mysql> quit
Next, download WordPress and place it on your custom directory and set ownership.
cd /srv/www/ wget http://wordpress.org/latest.tar.gz tar zxvf latest.tar.gz mv wordpress mysite.com chown -R apache:apache /srv/www/mysite.com/
Last step is to setup WordPress to work with the database you created.
Rename the sample config file
mv /srv/www/mysite.com/wp-config-sample.php /srv/www/mysite.com/wp-config.php
Now, use nano to edit file /srv/www/mysite.com/wp-config.php like so
/** The name of the database for WordPress */ define('DB_NAME', 'mysite'); /** MySQL database username */ define('DB_USER', 'mysite'); /** MySQL database password */ define('DB_PASSWORD', 'somepassword'); /** MySQL hostname */ define('DB_HOST', 'localhost');
Finaly, restart your webserver…
…and point your browser to the install script at http://mysite.com/wp-admin/install.php and follow instructions.
Enjoy your new WordPress server.
A minimal install of Slackware is very nice and slim, but will not actually do much, as is.
So, let’s expand it
This page is done with WordPress, and is hosted on a VM running a minimal Slackware + apache, mysql and php (the famous LAMP server).
So, as an example, we’re going to make a LAMP server out of our base system and use this new system as our back-end for WordPress.
As usual, all the steps not mentioned here are beyond the scope of this post.
Also, I assume you already have some registered domain (I’ll use mysite.com in this example) or even a free dynamic dns service to get something like mysite.dyndns-blog.org configured in your home DSL router.
So, let’s build our LAMP server!
The best way to do that, is using slackpkg.
First, let’s configure slackpkg by uncommenting a mirror from the /etc/slackpkg/mirrors file (since we have a Slackware 13.1 minimal system, we’ll need a Slackware 13.1 mirror).
You can use nano to accomplish this.
nano -w /etc/slackpkg/mirrors
After you do that, update the available package database with
Now, you can use the template I prepared earlier, to make this quicker
cd /etc/slackpkg/templates/ wget http://cybercenter.com.pt/slack-minimal/slackpkg-templates/LAMP-server.template slackpkg install-template LAMP-server
You have a LAMP server installed!
You will have to configure your new LAMP server
First, make the init scripts for mysqld and httpd executable, like so
chmod a+x /etc/rc.d/rc.mysqld /etc/rc.d/rc.httpd
Now, initialize mysql databases
chown -R mysql:mysql /var/lib/mysql/ mysql_install_db --user=mysql
Start mysql and assign a password to the ‘root’ user
/etc/rc.d/rc.mysqld start mysqladmin -u root password 'somepassword'
And that takes care of the mysql stuff.
Moving on to the webserver itself (apache).
You will need to uncomment the following lines in /etc/httpd/httpd.conf (you can use nano for that).
Both lines should be near the end of the file and are easy to find.
Next, change the the following section
<IfModule dir_module> DirectoryIndex index.html </IfModule>
To look like this
<IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
Now, use nano to change the /etc/httpd/extra/httpd-vhosts.conf file into something like this
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/srv/httpd/htdocs" </VirtualHost> <VirtualHost *:80> <Directory "/srv/httpd/mysite.com"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> ServerName mysite.com DocumentRoot "/srv/httpd/mysite.com" ErrorLog "/var/log/httpd/mysite.com-error_log" CustomLog "/var/log/httpd/mysite.com-access_log" common </VirtualHost>
Finaly, point your browser to http://mysite.com and you should be able to see the apache server test page.
Enjoy your new LAMP server.
Slack-Minimal is just that: a minimal installation of Slackware.
A bare minimum system with just enough packages to allow you to login and connect to the network.
It has slackpkg, which will allow you to easily turn this bare-bones system into whatever you want, from a simple web server to a full installation of Slackware.
I believe that one should start with a small system and expand it to fit your needs (this page is hosted on a VM with 512MB RAM and 1GB hard drive).
The official view is the opposite: install all then remove what you don’t need, as to minimize problems with missing dependencies.
If you are new to linux or Slackware, this is a good thing.
However, Slackware linux is one of the few distributions that does not make any assumptions about what you intend to do with your system, so it will let you do whatever you want, even if you end up with a broken system.
It simply lets the system administrator (that would be you) make all the decisions, including what packages to install.
In other words: the ‘install it all, then remove what you don’t need’ view is more like a guideline, not an actual rule, so you can actually install a minimal Slackware system if you so desire.
And we’ll do just that.
This minimalistic system may be useful for several reasons:
- Low resources – Although this would seem a lesser issue nowadays (the typical PC will have 1TB hard drive and 4GB RAM), the fact is that virtualization is taking an increasingly bigger role in the IT world. So, if either you install it on a VM or some older hardware (remember that Slackware is still compiled for i486…), you will not have a lot of resources.
- Security – The less packages you have installed on your system, the less possible bugs there will be (well, you can’t be hurt by a firefox bug if you don’t have firefox installed, can you?).
- Learning – It can be a cool project and you can learn a lot. Since Slackware does not have dependency checking in it’s package manager, each time you install a new package (from the official repository or not) you will most likely encounter a problem with missing dependencies and will be forced to deal with it, thus, become more experienced in knowing what is needed to make stuff work.
First of all, a few warnings: any steps of the installation not mentioned here are beyond the scope of this post.
As an example, I’ll be using Slackware 13.1, so you should adapt this to your particular case.
Also, you should fulfill the following requirements:
- 1 PC with a connection to the Internet
- 1 Slackware 13.1 install DVD
So, let’s start!
The easiest way to do this is using tagfiles, which are the way the setup program knows what packages must / should be installed.
By using your own tagfiles, you will greatly decrease the installation time of your custom system.
Fortunately, I already made the tagfiles for Slack-minimal so, after you have booted the install DVD and partitioned your hard drive to your liking, all you have to do is:
# turn on the network dhcpcd eth0 # then, download the tagfiles wget http://cybercenter.com.pt/slack-minimal/tagfiles/slackware-13.1/tagfiles.tar.gz # and extract them tar zxvf tagfiles.tar.gz # you are now ready to start the installer setup
Enjoy your new Slackware system.