torstai 29. elokuuta 2013

How To Install Wordpress

In the earlier post we just installed LAMP stack (Linux, Apache, MySQL, PHP) and also phpmyadmin to control databases with graphical interface. Now we are going to install Wordpress with graphical interface.

First we are going to create a new database for your Wordpress to use

1. Select Databases

2. Create new database (name it, I named it wordpress)

3. Click the database you just created below

4. Go to privileges and add new user to the Wordpress database.

5. Select username, password and select HOST to LOCALHOST. Gran all privileges on database wordpress.

Creating database for wordpress with terminal commands:

mysql -u username -p
create database wordpress;
use wordpress;
create user 'wordpress'@'localhost' identified by 'nakki';
grant all privileges on * . * to 'wordpress'@'localhost';
step one open mysql prompt
step two create database named wordpress
step three use our new database
step four create user named wordpress with password nakki
step five give access to selected database

6. Go to and download newest version of Wordpress
7. Unzip the Wordpress somewhere for example Desktop.

tar -xvf latest.tar.gz

8. Open the unzipped folder and locate file wp-config-sample.php, copy it and rename it to wp-config.php
9. Now open the wp-config.php with text editor. Safest way is to use Nano from terminal, it doesn't mess up the text and should work always.
10. Fill all the information and remember to give good passwords. Because I forgot.

11. Now go lower and you find this kind of information:

12. You need to fill in your unique salt keys.Just google Wordpress salt and select first link ( don't know if this link works.

Copy the salt key there.

13. Now save it end exit.
14. Time to move your wordpress project into /var/www rename the folder if you want and move it.
To do this with terminal: sudo mv wordpress /var/www
15. Showtime. Open your browser and type localhost/wordpress if you see wordpress installation to open thats good!

Fill in the information and press install. If everything goes fine This installation was a succes. You can pat yourself on the shoulder and smile.

16. Log in with your account and start blogging!

Creating shell script

There are thousands of command in Linux. How are we supposed to remember them all ? This little trick will help you to do some things faster. We are going to do a shell script. Open terminal and change directory where you want to store the shell script. Then we are going to do a shell script named "mystatus" type


Inside this file we are going to type:

df -h

This is supposed to show information about your disk space and interface (ip, mac address) Of course you could type any command in to this script. Press CTRL + O (save) when you are ready and CTRL + X to exit. (nano shows all the command in the bottom of terminal ^ means same as CTRL + letter. 

To run shell script open terminal, locate the file and type


It should show the information we wanted.

Make the script runnable for everyone for everywhere

Insert in the beginning of the script this line:

#!/user/bin/env bash

It means it looks bash from every place, it can be used in any Linux version.

Then move it to /usr/bin
sudo mv /usr/bin/
Give permissions 
sudo chmod 755

And run from example your own user directory.

Setup SSH server and automatic login

If you need to acces your server remotely ssh is best for it. Start by upgrading your repositories

sudo apt-get update

then install openssh-server

sudo apt-get install -y openssh-server

Now type ssh localhost to see if the demon is working. If it asks fingerprint then everything is okay. Select yes if you are going to use ssh later. Now if it asks password and you see yourname@ubuntu:~$ or the basic terminal text you have now just succesfully logged in. There should also be the default welcome screen in terminal window.

If you did'nt get the fingerprint thing it is possible that you don't have account name yet (for example if you are using live-cd) Add a new user with  sudo adduser. Now you can test to log on to the computer with ssh yourname@localhost and it should work out of the box because every user has ssh settings by default. If this worked now try to log on from another computer (if you have computers in the same network). Exit from ssh with simple command exit

If you want to ssh outside from your network you need to setup your firewall correctly. This is more complicated thing and I suggest you to look more information from

Setting up ssh automatic login

ssh to your new user for example ssh seppo@localhost
Create new ssh key with ssh-keygen -t rsa 
Just press enter in every step. No password and no location for file.

Next commands go to .ssh folder and see if you have key files generated:
cd .ssh/

Move public key to a file authorized keys, set permissions that no one else can see the folder and delete the other key pair.

cat >> authorized_keys
chmod 600 authorized_keys 

Next close your ssh connection with exit. Go to .ssh folder and copy the ir_rsa file, again hide the file from others:

cd .ssh/ 
scp seppo@localhost:.ssh/id_rsa 
Copying from remote host:  
scp seppo@ /home/username/.ssh/
chmod 600 id_rsa

Now everything should be ready to test. ssh seppo@localhost


How To Setup Virtual Linux In Windows

Want to run virtual Linux inside your Windows ? There are many advantages using virtual machine. For example it is good for testing and experimenting. If something goes wrong, one can easily just destroy the virtual machine and setup a new one. Your Windows operating system is not touched and is therefore very safe to play around.

This is only tested in Windows 7, probably runs on XP, Vista and 8 also. Download VMware Player here: install it to your computer. In this post we are going to use Xubuntu. So go to Xubuntu home page and download the latest version and also 64 or 32 bit version depending on your machine. You can easily check your Operating system from Control Panel\All Control Panel Items\System

Now open VMware Player, click create a new virtual machine button.

In the next screen select Installed disc image from file (iso): and locate your Xubuntu iso file

Insert your name and set password in the next screen.

Then select name for the operating system and folder where it will be installed. 

Now select how much disk space you want to give for your machine. You can also select if you want to store the Linux in one single file or split the files. If you select split disk it should be easier to move the virtual machine on another computer but if you are not going to move it then I would say pick the single file. It offers better performance.

In the last screen select customize hardware if you want to change the default options. If you have a lot of RAM memory for example you should make it bigger, the default is 1 gigabyte but for example I have 12 gigs so I changed my virtual machine to use 4gb of memory and I also have 6 core processor so I gave 2 of the cores to virtual machine. This made the virtual machine run way smoother than with the default options. 

When you are ready to move on, tick the box power on this virtual machine after creation and click finnish. 
Now it should start installing Xubuntu. After installation you can use your virtual Linux machine like it was installed as main operating system. You can power off the virtual machine and continue later, everything is saved to hard disk. It could be said that it's like in the movie Inception, operating system inside operating system. So if you make it full screen it may take while to get used to it.

keskiviikko 28. elokuuta 2013

HowTo Make Bootable Linux USB-Stick In Windows

Do you want to use Linux straight from the usb stick ? Or Install from the stick ? This is how to do it.

Go to and download the installer: or download the installer from here:

Download the Linux version you want to use. In this example we are going to use Xubuntu 13.04. Go to Xubuntu web page and download 64bit or 32bit version depending on your system.

This program can install many versions of Linux to usb stick and also versions that are not listed. Open the program, select your Linux from the drop down list, then browse for the linux iso file you just downloaded. Step three, select usb drive. I always check the format stick box just in case. Click create and that's it!

Now put the stick on to your computer and boot it. You may have to choose from bios to boot from usb.

Installing Xubuntu 13.04 from the usb stick.

maanantai 26. elokuuta 2013

Ubuntu Linux: Start / Stop / Restart OpenSSH ( SSH ) Server

How To: Install LAMP w/ PHPmyAdmin on Ubuntu or Xubuntu

Easiest instructions here:

Install L(inux) A(pache) M(ySQL) P(HP)
First we need a software called "tasksel"

sudo apt-get install tasksel

Then we need to install the LAMP Stack

sudo tasksel install lamp-server

When prompt give a username and password for MySQL users, also select Apache2 to be configured

Installing PHPmyAdmin
Install phpmyadmin from the repository

sudo apt-get install phpmyadmin

Then we need to install php5-gd

sudo apt-get install php5-gd

Create a symbolic link for phpmyadmin to be access

sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

Then restart apache to take changes

sudo service apache2 restart

Now test your webserver, open web-browser and type:
http://localhost/ | http://localhost/phpmyadmin

phpmyadmin default username is root.

also to test if php is working create a new file in /var/www for example keppi.php and insert this code in to it

<html> <head>
<title>PHP Test</title>
<?php echo '<p>Hello World</p>'; ?>

If it prints out it should work just fine.

tiistai 6. elokuuta 2013

HowTo Find Out or Display The Ethernet Address (MAC)

If you need to find out your MAC address for example from laptop where there is no way to find the little sticker on network card which tells it.

Boot in to Linux, open terminal and type: ifconfig -a
Look for a line which says something similar: HWaddr 00:08:9b:c4:30:31
This is your MAC

More about the MAC address:

maanantai 5. elokuuta 2013

HowTo Completely Wipe Data From Hard Disk With Xubuntu

I had to erase all data from Laptop which had top secret material on it. This is how to wipe all data from hard drive with Linux.

1. First create bootable Linux cd or usb stick.
2. Open terminal and see if you have shred installed by typing: which shred
3. If it not installed you can install it with: apt-get install coreutils
4. Figure out which hard drive you want to erase: sudo fdisk -l
5. Wipe out disk (/dev/sda is the name or location of the disk): sudo shred -vfz -n 10 /dev/sda5

v: show progress
-f: change permissions to allow writing if necessary
-z: add a final overwrite with zeros to hide shredding
-n: overwrite N times instead of the default (3)

So this would overwrite /dev/sda5 ten times.