
How to install WordPress on Debian Server 6.x Squeeze in 10 steps.
For installation you will use ssh and w3m. The installation should be identical with Debian Lenny 5.x.
The multisite configuration is that it is also good for those who have only one blog/site on your server.
In this guide, the blog will URL http://www.example.com, the configuration can also be used on a test machine. In this case, use a URL like http://www.example.invalid to avoid having problems.
Have you ever tried to install WordPress on Debian?
I did a little ‘of times and I struggled a lot, setting the directory to upload media files and multi-configuration gave me several headaches. Eventually I managed to find a way.
This procedure uses the Debian package WordPress and manages the multi-second Debian style so you do not have problems with apt updates.
1. Prepare and install the necessary tools
Access to the server:
$ ssh user@name_server
Install the programs utility:
$ sudo apt-get install pwgen vim w3m
Install the WordPress Package:
$ sudo apt-get install WordPress WordPress-l10n
WordPress-xrds-simple WordPress-openid
If not already installed, install mysql-server
$ sudo apt-get install mysql-server
2. Create a database for WordPress
The user will create the database that WordPress will use to create and use tables. Here I used: for example the database name, user name WordPress_agent for WordPress. Use pwgen to generate a secure password, in this case is: mooNoaZ3. I highly recommend you create your password. Do not use this for no reason!
Write down why you need this information back to step 4.
$ pwgen
aTh6Ohbe Eipho7ie maiPa8pu ech6Aebo shoh8Cie iu7haiD7 Ao1Fiem8 chae6Ui9
cheiy4Ei YeiB1ohy beRoh5id bie5ooBi ieQuoo4l ahShaa1i eeK1ri5k Oe2seesh
AiY4ud5e Ooboath4 ohz2eu4X eer9Gi3u Aijeuk3a wia8Kemu xeDohx1o aegie1iM
Queil4oo ohme4Air OoH0aa1m ieShae2a phahde5V Taimah7b Diziec1e ohP2ooSo
Eem5oich aoBae0ie ya8Vaipe AuWo8ieK YaiD5uba ohK2bahW iQuohgh7 ooSh7wo0
eki4sheX iu5Thaoy phee9EKu ongu2Fee eeQuosh8 Wa8Poth9 kaenai5S eiCeem3e
eyaYai1a ioCie2ed Tae5hae6 Sha9Vohs Eng6ix2J shee0aiK Ugha5bad seiV8pa2
Tu2izahg aise8Eid me5Hiloh pah5aeW9 AiNo9lae jei6Daed Ocie7Iey Ahwipa9i
Oochu8le ohFae5ja aotaiT2m peTu7tho joh6iGie Pha2eiTh requ9Oyo Yaifi4ah
vohD1ogh chieth6F oora8ATh yogaiSh1 Vof4aich iaJ8chai Mo0nef0d Oow3Xeiz
eo5jieNg kieYu4Do mooNoaZ3 koV4piex Phae5Peb thisohR0 ookohZ6o Ieth5ooh
Fiemias4 eig2Aeph ohr9IeQu ooBa9ohj eiRoo9gu maTah4uu thee9Ool dieZoo6a
aenov1Ch Apaexee8 YeiM2ulo Oocex7Ie Lem3phoo Ahtohk8i Vaegai7m chat8UQu
Coongae5 Vieb1dep ujeeH3oo ai9ieXik Fee8fav5 voe0Eifo chohRah3 Xae9Aeph
Udae1yoo oPhoogh9 eec0aeSh feida8aH vuM4icum Eeloh5bo OF1jaes6 oox7eeMe
xeikuoX8 Chahle1l aiThais2 aicuZ3ae izooJ0ch fieyai5A Ru0to5er sha4Wain
ongie4In eeM9zohd zieg2ooJ Iudahc0c seeQuai9 Sohyoo6z Bongoo3k pha9Aech
chio2uTh uuJee9oh HaeC7eib xeiY7quo ohtaTu1H Phaiph7M yi8Eisei ohLai2oh
ehai7soK ve0der4L Aisen2ze eicuX4Ah Faer6Doh OoVah8ah Seith4ae ung7ohPa
ea0oeGho Loo1lo6c apoht9Wa kei2Iet0 Yoat2eud eeThie8n ieCh7aiw caip1uZa
$ mysql -uroot -p
mysql> CREATE DATABASE example;
mysql> GRANT ALL ON example.* TO 'WordPress_agent'@'localhost'
IDENTIFIED BY 'mooNoaZ3';
mysql> quit;
Check that everything is working properly by accessing the database.
$ mysql -uWordPress_agent -p example
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| example |
+--------------------+
2 rows in set (0.00 sec)
mysql> quit;
3. Add aliases for the server.
Make a backup copy of the hosts file and then edit it with vim. Enter an alias for the server name at ip adress….
$ cd /etc
$ sudo cp -p hosts hosts.bak
$ sudo vim hosts
The file must be as follows:…
127.0.0.1 localhost
127.0.1.1 my_server
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.0.101 my_server example.com
4. Create a directory to upload photos and other multimedia files.
The files will be saved in the directory /srv/www/example/
$ cd /srv
$ sudo mkdir www www/example
$ sudo chown -R www-data:www-data www
$ ls -l www
totale 4
drwxr-xr-x 3 www-data www-data 4096 4 mar 21.55 example
5. Prepare the configuration file of WordPress.
In the file config-example.com.php, you must put the data you used to create the database and that you noted in step 2. Now copy the file wp-config-sample.php in the directory with the configuration of WordPress, and rename it as config-.php.
$ cd /etc/WordPress
$ sudo cp /usr/share/WordPress/wp-config-sample.php
./config-example.com.php
Now edit the file and edit it with vim. Enter the information you wrote down when you’ve modified the database. Enter the language to use. Enter the secret keys that are at https://api.WordPress.org/secret-key/1.1/salt/
$ sudo vim config-example.com.php
The file must be amended as follows:
O0o2XYY?;52-qD|wMa1+a_EAyGibqf]H+#A8');
define('NONCE_KEY', '..-ywRGH``H{,YoEaYvDh;0gA-ggMj Gb=?:lPp=(N.');
define('AUTH_SALT', 'BpFN):ebeKC|rA=IL&ocV,?+aEQj/ANv({k|xfMqM%kZH`?-7oYm`Lz5[2Mlon|]');
define('SECURE_AUTH_SALT', 'U8=rPc#hm}@.ZJ|@d,MR]?=Uh@K-k,R[W+euPd|+{-tO-ME8j`|h+qTL;I(TFG7S');
define('LOGGED_IN_SALT', '~ {hD`b#+Q[hatf&;(^3P=.>/:DUn;9sn%E|4>gK^&Hzu&i-Y(+B@,Z*K-xgs}=:');
define('NONCE_SALT', '5+H@Sa[:bxJTa|R*Lg>%7UQo-aaI|w{| F4no#P!IsOi.?T^5-<%(-jpj:Ph0.k}');
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de.mo to wp-content/languages and set WPLANG to 'de' to enable German
* language support.
*/
define ('WPLANG', 'it_IT');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');6. Remove the comments in the htaccess file in the directory /etc/WordPress.
You have to uncomment the section "Configuration for multi-site installation by WordPress using subdomains"
$ cd /etc/WordPress
$ sudo vim htaccess
The file must be changed to this:
# For rewrite rules needed for making WordPress URL friendly
# See Options -> Permalinks for details and please use the defaults,
# especially in mind when hosting several blogs on one machine!
##
## Configuration for a single blog hosted on / (root of the website)
##
#
#RewriteEngine On
#RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
#
##
## Configuration for a multi-site WordPress installation using subdomains
##
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
# real files dealt directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# other go through index.php
RewriteRule . index.php [L]7. Create the configuration file for apache2 Blog
Now you must create the file to configure apache2 to show the blog when you enter the URL example.com. Copy the sample files found in the documentation of WordPress. Edit the file and post the rules for mod_rewrite….
$ cd /etc/apache2/sites-available
$ sudo cp /usr/share/doc/WordPress/examples/apache.conf ./example.com
$ sudo vim example.com
The file must be as follows:
ServerAdmin myself@localhost
#We want to be able to access the web site using www.example.com or example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /usr/share/WordPress
# Log levels: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
#we want specific log file for this server
ErrorLog /var/log/apache2/example.error.log
TransferLog /var/log/apache2/example.access.log
# Store uploads in /srv/www/example
RewriteEngine On
RewriteRule ^/wp-uploads/(.*)$ /srv/www/example/$1
8. Enable rewrite modules and enables the site and vhost_alias
$ sudo a2enmod rewrite
$ sudo a2enmod vhost_alias
$ sudo a2ensite example.com
$ sudo /etc/init.d/apache2 reload
9. Create your account for WordPress.
Now you have to use w3m to launch the installation process and create your own WordPress user. The user will have administrator rights. Use pwgen to generate a secure password for your user.
$ pwgen
Riiz0oon foh2Ail5 Sisii3Be Toosh5oB Ohngiok2 oSeen8th UJ1baeca Agee5sho
taht1Ahb ohb2eiF3 iqua3ahX iet1laGu toaZa1Ei se6Sheif ohhei9Ei zaiGh2ph
aiDaeF9l utahX6yo ooghie5G nooy4Ohc ahSae3na nu4Yeu7j iePhu7tu ieB3ahsh
ohaoL1sh Aichohy7 jaiTh7xe Ua5quooy gous4Cho Ahr0giem deiJie7y Kekahh8m
iboosa9I eelei9Uu Phoey3Ai phaF5dah eew6aeNi Jie1augh eFie3ga5 aesh2Shu
thee5aiM Iequ5aim Oxies6ee aiji5uGu uNg5chai Ohcae0Th dae9foeK Rae5cei1
Oibei9ee ahNoh1oh rook2ohF Zoe6ieci uH2ra0ip vieb2Loh Eejie4ee thaiGhu5
deikie3R Ahk3OiY7 ooPae4Ah jahp1Yoh aih1Oth8 akeJ3Ahp kap4Icie nooN1iad
ohme1Toh air4Cha8 Choh5vie Oogi3gay Uyaepie2 peeZai3K im2IeGuV ooH1po8P
Ieth3aen pheoNge0 bei0ea0A Iewo0foh reiThu8v uiNg7boh foo0aFoo uu5chiaY
Oo5iesho uw4UmiGi ohfeeP0a ooL6jiwo ahdaiN0o ith1Koht aeG1la7i quee1Ooy
Aighah4A Pheecuu1 iR7ooloo eeCea8ae nahqua2E Hie4foo8 iDaeH1ae Teex2ooS
soo1aeR3 Ri2ojoof aquau3En eiNguw8i um4Ye5ie Ishe2Dai oogh7Phi eeki1Oce
yo3Aehu9 wiH6geeB eebeeP3g aiF6vuu7 ahthae7B eijeeGh3 eeg1ZuXe Oosoo9ee
Kae9coov Ronei2zi aifo6Ieh la7ohTae Aiqu9xu3 ThoNei5o xohDin2d Quai8aiP
yoht4aFo Aig9jail Aipav5oh lahYoh7a AeX0caph cuxei4Oh Xeilej9g jo7aiG4u
ohThi8ee Pie6aexo No1xoham Ahsae0fu EeB4Aez8 esh5Booh OoSi8bie OoriN8oe
eeN6Tho5 remao7EX riH8pooj quie2OoP ku8mua2U Wo4eingi Co6vaoke IeQuoo9X
Wah1Quoo aejie4Ee aeghae9V Cah1bieD jainae3D Of9eeshi cu3thi3O AeBay3ph
iis2dahD HoS0daiv ieghee3M phied9Lo euhuLoo8 ey7eiCh2 er8EiN2h phoo9Vig
Write down the password you typed: aquau3En. Launch your browser w3m at http://example.com/wp-admin/install.php
Proceed carefully: you must use the tab key to move forward between links.
When you finish on a text field (highlighted in red) press enterand write the text. Press enter again to enter the text you typed. I suggest you do a test on google.com before beginning to practice.
$ w3m http://example.com/wp-admin/install.php
Enter your username, your email address and password, confirm and you’re done.
10. Configure WordPress.
Now the blog should be active (hopefully). Access the blog at http://example.com/wp-admin/. You must set the values in the file upload.
Store uploads in this folder: /srv/www/example.
Full URL path to files: /wp-uploads.
Edit the settings as in the image below:

That’s it! Now you have to configure your blog as you want and start posting. Congratulations.
Credits:
By WordPress WordPress-logo.png [GPL (www.gnu.org/licenses/gpl.html) or GPL (www.gnu.org/licenses/gpl.html)], via Wikimedia Commons