TechChat • View topic - How to make a home server - Ubuntu 9.04

How to make a home server - Ubuntu 9.04

<<

iTM2

User avatar

Global Mod

iTM2

Posts: 306

Joined: Sun Apr 19, 2009 2:35 pm

Global Mod

Post Wed Aug 05, 2009 5:19 pm

How to make a home server - Ubuntu 9.04

This is a simple *cough* not really *cough* guide on how to turn a spare laptop or something into a media server. Using the greatest OS on the face of the planet, Linux *cheers*.


This is just how to access your home server LOCALLY. I will be putting up another guide telling you how you can access it from anywhere in the world as long as you have an Internet connection.


Let's get started, shall we?

I'm going to first start off by giving you links to all my resources... Here they are:
Benji Korsak. First comprehensive guide that I actually ever found. It worked quite well, actually. I just needed to change some of the codes around so that they would actually WORK. Don't use the last page, it's useless.
Systm - Dynamic DNS. Systm was one of the greatest shows, of all time. Well, when it comes to tech stuff like this it is. May it rest in peace.
Tech Support Forum. These people are skilled in just about everything. Anything you throw at them, they can answer. Usually... Don't be afraid to ask questions!
UbuntuForums.org. Just a post that I made on UbuntuForums.org and I had some very friendly people help me out. I love communities :D
Life Hacker. This is the source for my next guide... Know that it's coming :D


OK. Now that you've got those links read and at your disposal, we shall finally get into the awesome fun part that is...


CREATING A HOME MEDIA SERVER!!!! *cue awesome music*

Alright.


First, you'll need these things:
A spare laptop or desktop computer
Said computer device of choice must have enough hard drive space for your files you wish to share
MUST have an internet connection (preferably wired using Ethernet, but a STRONG wireless connection will work too)


I am using an old (OLD) Dell Inspiron 1150. It works great as a media server, because the backlight doesn't work, which means that it is useless to me as a laptop.

Alright so there are two ways you can go about doing this next part:
You can install the latest version of Ubuntu over at their site.
OR
You can get the server edition at their site.

I went with the desktop version, because that is all I had at the time and my main computer was out of comission at the time being. So, I went with the desktop (plus, it was a bit easier with a GUI).
If you use the server edition: At the end of the installer there is an option for the type of server. You will choose the LAMP server. the LAMP server is:
Linux Apache MySQL PHP/Perl/Python
If you decide to use the desktop edition, I will walk you through the process of getting the stuff required for a LAMP server.
THIS GUIDE WAS WRITTEN USING UBUNTU 9.04 DESKTOP EDITION.

OK. Now for the REAL instructions:
(I suggest copy-pasting these commands into the terminal, because that way you won't get confused by letters and what have you. To paste into the Terminal on Linux, just tap the third mouse button, or the scroll wheel. If you do not have one, just right click>paste [I think]).

You're going to be installing SSH so that you can access your computer remotely, for whatever reason.
Open a Terminal window (The Applications tab in the top left, and then the first section down. It's sorted in alphabetical order, so Terminal will be near the bottom of the list). Type this command:
  Code:
sudo apt-get install ssh

Sudo is the command used to get root privileges. All apt-get commands MUST be preceded by sudo. Otherwise, you will get an error 13 message asking if you're root or not. You will be prompted for a password when using sudo (unless you've used sudo before in that session of the Terminal). Apt-get is just the command used to tell the computer to use the package manager. It's used to install software in Linux. Install is very straightforward ;). SSH is the name of the thing you are installing. SSH stands for Secure SHell. It allows you to remotely access your computer from anywhere.

Now, if you wish to use a different computer for the rest of this guide, you can. You'll need to grab a copy of Putty, however. Don't worry, it's freeware.
In the terminal type:
  Code:
ifconfig

You should see a number (in the long list that appears) that says something like 192.168.15.x, or something similar. This is the INTERNAL IP address of your Linux box. You will type that into the host address of Putty. Leave everything else alone and hit connect. Then you'll need to type in the username and then the password. Then you can do whatever you want within the TERMINAL interface. Not a GUI ;)

No make sure it's up to date...
  Code:
sudo apt-get update

And install those updates:
  Code:
sudo apt-get upgrade

Now you should be good to go!

Now you'll need to install Samba. Samba is used to connect your Linux machine to a workgroup.
  Code:
sudo apt-get install samba smbfs

Now you need to stop the Samba service so it doesn't interfere with the next commands:
  Code:
sudo /etc/init.d/samba stop

And now you'll need to move it so that you can easily find it within your server:
  Code:
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig

The mv command just means move.
You'll need to create a file for Samba:
  Code:
sudo touch /etc/samba/smb.conf

And then edit it:
  Code:
sudo pico /etc/samba/smb.conf

And now you'll need to paste this stuff into the space that will appear:
  Code:
[global]
    ; General server settings
    netbios name = YOUR_HOSTNAME
    server string =
    workgroup = YOUR_WORKGROUP
    announce version = 5.0
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

    passdb backend = tdbsam
    security = user
    null passwords = true
    username map = /etc/samba/smbusers
    name resolve order = hosts wins bcast

    wins support = yes

    printing = CUPS
    printcap name = CUPS

    syslog = 1
    syslog only = yes

;[homes]
    ;valid users = %S
    ;create mode = 0600
    ;directory mode = 0755
    ;browseable = no
    ;read only = no
    ;veto files = /*.{*}/.*/mail/bin/

;[netlogon]
    ;path = /var/lib/samba/netlogon
    ;admin users = Administrator
    ;valid users = %U
    ;read only = no

;[Profiles]
    ;path = /var/lib/samba/profiles
    ;valid users = %U
    ;create mode = 0600
    ;directory mode = 0700
    ;writeable = yes
    ;browseable = no

[print$]
    path = /var/lib/samba/printers
    browseable = yes
    guest ok = yes
    read only = yes
    write list = root
    create mask = 0664
    directory mask = 0775

[printers]
    path = /tmp
    printable = yes
    guest ok = yes
    browseable = no

;[DVD-ROM Drive]
    ;path = /media/cdrom
    ;browseable = yes
    ;read only = yes
    ;guest ok = yes

[MyFiles]
    path = /media/samba/
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    force user = YOUR_USERNAME
    force group = YOUR_USERGROUP

(THERE ARE SEVERAL DIFFERENT TEXT EDITORS. PICO IS INSIDE THE TERMINAL, BUT YOU CAN USE GEDIT IF YOU SO CHOOSE. GEDIT IS LIKE NOTEPAD, BUT IN LINUX. GEDIT WILL ALSO ALLOW YOU TO USE CONTROL + F TO FIND THINGS; ESPECIALLY USEFUL IN THE NEXT SECTION).

  Code:
Replace "YOUR_HOSTNAME" with anything you want, preferably the name of your Linux box
Replace "YOUR_WORKGROUP" with the name of your Windows workgroup
Replace "/media/samba/" with the path of the folder you want to share
Replace "YOUR_USERNAME" with your username


Now you'll need to save it:
  Code:
Control + X
Y (The letter y, just tap it ;))
Enter


Now you'll want to set the permissions so that you won't have any issues with the Samba service.
REPLACE "/media/samba" WITH THE DIRECTORY THAT YOU SPECIFIED EARLIER (about 8 lines up).
  Code:
sudo chmod 0777 /media/samba

For example, I used my Music directory. So MY code would look like:
  Code:
sudo chmod 0777 /home/dilyn/Music


Now you'll need to add a user:
  Code:
sudo smbpasswd -a system_user

  Code:
sudo pico /etc/samba/smbusers

And insert the following line into the new file:
  Code:
system_username = "network username"

And save it:
  Code:
Control + X
Y (The letter y, just tap it ;))
Enter


And now you're all done!!! ...With Samba...


Go onto these next steps to setup your awesome amazing new software:

Jinzora!!!

You can read about it if you want... But it's basically just a web based browser thing that allows people to browse through your media in an interesting way.
Just something fun for you!
My server has been up for:
  Code:
up 1 day, 16:29

Since 12:32:11 (PM).
It's working like a charm :ugeek:

So now you'll need to install LAMP and set it up for Jinzora to work properly.

PAY CLOSE ATTENTION.

WHENEVER I USE THE WORD 'pico' IN A COMMAND, FEEL FREE TO SWAP IT OUT WITH 'gedit'. THEY DO THE SAME THING, BUT GEDIT ALLOWS YOU TO SEARCH FOR TEXT USING CONTROL + F, WHICH MAKES THESE NEXT STEPS A LOT EASIER.

Now run the following commands in the terminal:
  Code:
sudo apt-get install apache2

  Code:
sudo apt-get install php5

  Code:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

  Code:
sudo apt-get install php5-gd


Now you'll need to configure PHP5 in order for it to meet Jinzora's requirements.

  Code:
sudo pico /etc/php5/apache2/php.ini


Now change these values:
  Code:
"max_execution_time" to 300
"memory_limit" to 128M
"post_max_size" to 32M
"file_uploads" to On
"upload_max_filesize" to 32M

This will allow PHP5 to work correctly with what Jinzora requires it to do. Unless you change these values correctly, you WILL NOT be able to install Jinzora. It just won't let you.

Now you'll need to configure MySQL (pronounced My Sequel). You'll need to make it so that the database can be accessed from the computer.

  Code:
sudo pico /etc/mysql/my.cnf


And change these values:
  Code:

bind-address = localhost
to
#bind-address = localhost


Now here is where I ran into some trouble. If you're not looking at the rubbervir.us site that I linked to at the beginning, you don't need to worry. But if you are, don't listen to his commands that he gave you for the MySQL part. They're WRONG in just one little, tiny way.

  Code:
sudo mysql -u root -p

I don't even know what -p needs to be there for, but it does. If it's not there, it won't work. Now just edit these values:
  Code:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

Change the "PASSWORD('yourpassword')" part with a password of your choosing. LEAVE THE SEMI COLON THERE.
  Code:
GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

Change 'yourusername' with a username of your choosing. LEAVE 'localhost' ALONE. Change 'yourpassword' with the password that you added in the previous bit.
  Code:
/q

Now you've properly configured MySQL.
DON'T FORGET THAT USERNAME AND PASSWORD. You will need those for setting up Jinzora to work correctly.

Now here's where all that work comes into play:
Restart Apache.
  Code:
sudo /etc/init.d/apache2 restart

Apache SHOULD eventually restart itself.
Now open up your browser and enter your IP address. If you forgot what it is, just type
  Code:
ifconfig

into the terminal again.
You should be greeted by a page either saying "It works!" or listing off a whole bunch of stuff about Apache and things... If not, you'll need to do some port forwarding.

Find your EXTERNAL IP address. Just use
  Code:
ifconfig

again, and you'll be able to find it. Now enter that IP address into your web browser. Login to your router's configuration page. My router is NOT the same as yours, but you can go here to figure out what you need to do for your router. After you select your router, look in the A's section for Apache and click that. You'll need to forward ports 80 and 443.

Now you get to do the fun part:
Installing Jinzora!!!

Go and download it... Shouldn't be too hard. If you want to be lazy about it, just enter this code into the Terminal:
  Code:
wget http://en.jinzora.com/downloads/jinzora_releases/28

If that is not latest stable version, then I suggest you go over to their site and you download it. When you download it, but it on your desktop and use this command:
  Code:
cd /home/'YourUsernameHere'/Desktop

(Replace 'YourUsernameHere' with your username ;))
And then run these commands:
  Code:
sudo tar xvzf 'name of Jinzora'

  Code:
sudo mv 'Name of the extracted folder' /var/www/jinzora2

  Code:
sudo rm 'name of the tar'

  Code:
sudo chmod -R 777 /var/www/jinzora2

(Replace the things in little quotes with the actual thing's name).

Now the rest of this can be done in your web browser.

Enter the IP address of the server into your browser.
If you don't see a list of things within the '/' directory, and you just see a window that says "It works!", then enter this code into the terminal:
  Code:
sudo rm /var/www/index.html

Now you should be good.
hit the directory that says 'jinzora2/'. Now you just need to proceed through the web based installer.

Click the "Proceed to Requirements>>" button.

Read through all the information on the screen, you should not see any red words under "Requirements" other than the proceed button.

Yes, good? Click the "Proceed to License>>" button.

Agree and continue.

Click the "Proceed to Main Settings>>"button.

Fill out the text boxes, but this time leaving "Default Access Level:" and "Backend Type:" as is and continue.

Once again fill out the text boxes leaving "Database Server:" and "Database Type:" and changing "Create Database:" to true. Continue.

Everything should have been successful. If it says failed created database, double check that on the previous page you used the same user name and password you created when setting up MYSQL. Hit "Proceed to Import Media>>"

Here is where you specify the location of your media, if you did not change it from the previous tutorial it will be in /media/samba/. So navigate to that directory and select analyze. How much media you have will determine how long it will take to import. About 15 songs per second.

Click "Proceed to Save Config>>," "Proceed to Launch Jinzora>>," choose to share anonymous stats or not and finally click "Launch Jinzora"

Login and explore. Now it should say something about it not being secure, so open up ssh again and from the terminal type.
  Code:
sudo rm -r /var/www/jinzora2/install


Refresh and explore.


If you restart your server, you may have issues connecting to it again. Here's what you'll want to do:

Upon restarting your server, enter these commands into the Terminal:
  Code:
sudo /etc/init.d/apache2 restart

  Code:
sudo /etc/init.d/mysql restart

Now it should work just fine.



Again, this is just how to access your home server LOCALLY. I will be putting up another guide telling you how you can access it from anywhere in the world as long as you have an Internet connection.


Alright, here it is. How to access your server from outside your local network. Enjoy!!!
Gigabyte EP45-UD3R motherboard
Intel Core 2 Duo 2.66Ghz OCed to 3.4Ghz
Freezer 7 Pro CPU fan by Arctic Cooling
EVGA nVidia GeForce 9800GT OCed to 700/1780/960
Corsair TX750W PSU
2GB DDR2 RAM - 2x 1GB G Skill
500GB Western Digital Caviar Black HDD
Windows 7 RC 7100 and Ubuntu 9.04
MODDED Rosewill R604-P SL mid ATX case
Full system details
How to setup a home server using Ubuntu 9.04
Case mod :D
Image
Image
<<

Hikorashi

User avatar

Global Mod

Hikorashi

Posts: 34

Joined: Thu Apr 23, 2009 9:07 am

Location: Braintree, UK

Global Mod

Post Sat Aug 22, 2009 3:02 pm

Re: How to make a home server - Ubuntu 9.04

Awsome guide, i see you went into a lot of detail O_O which is good :D
Image
<<

iTM2

User avatar

Global Mod

iTM2

Posts: 306

Joined: Sun Apr 19, 2009 2:35 pm

Global Mod

Post Sat Aug 22, 2009 3:12 pm

Re: How to make a home server - Ubuntu 9.04

Ya I see lots of guides that lack sufficient details. It really pisses me off O.o

so I decided to pak as much detail into it as physically possible. Good thing there's either a very high character limit, or NO limit :)
Gigabyte EP45-UD3R motherboard
Intel Core 2 Duo 2.66Ghz OCed to 3.4Ghz
Freezer 7 Pro CPU fan by Arctic Cooling
EVGA nVidia GeForce 9800GT OCed to 700/1780/960
Corsair TX750W PSU
2GB DDR2 RAM - 2x 1GB G Skill
500GB Western Digital Caviar Black HDD
Windows 7 RC 7100 and Ubuntu 9.04
MODDED Rosewill R604-P SL mid ATX case
Full system details
How to setup a home server using Ubuntu 9.04
Case mod :D
Image
Image
<<

Reditus

User avatar

Owner/Forum/Site Admin

Reditus

Posts: 462

Joined: Sun Apr 19, 2009 2:47 am

Owner/Forum/Site Admin

Post Sun Aug 23, 2009 2:11 am

Re: How to make a home server - Ubuntu 9.04

iTM2 wrote:Ya I see lots of guides that lack sufficient details. It really pisses me off O.o

so I decided to pak as much detail into it as physically possible. Good thing there's either a very high character limit, or NO limit :)

There is a limit of 35000 characters, as long as people dont abuse that right to have that many, then we dont mind. i think your approx characters you used were about 14000-15000.
Windows Windows Vista Ultimate x64
Intel Core 2 Duo E6750
- OC'd from 2.66Ghz to 3.41Ghz - x8.0 multiplier - 333Mhz to 421.0Mhz
3GB DDR2 Dominator Ram - OC'd from 1066Mhz to 1135Mhz
Biostar TPower I45 5.x Motherboard - Rated FSB OC'd from 1333Mhz to 1684Mhz
2x ATI Radion 4890 XXX Edition running crossfire
- GPU Clock 1020Mhz
- Memory Clock 3980Mhz
All nicely packed in a iCute S901-5G1-BB - Full ATX Server style case
Watercooling FTW
<<

iTM2

User avatar

Global Mod

iTM2

Posts: 306

Joined: Sun Apr 19, 2009 2:35 pm

Global Mod

Post Sun Aug 23, 2009 2:19 am

Re: How to make a home server - Ubuntu 9.04

:lol:


Ya I was freaking out about character limits while writing this. I was gonna be super <censored> if it cut me off :x

But umm... Ya. I like the 35,000 character limit. Allows people to write detailed guides :)
Gigabyte EP45-UD3R motherboard
Intel Core 2 Duo 2.66Ghz OCed to 3.4Ghz
Freezer 7 Pro CPU fan by Arctic Cooling
EVGA nVidia GeForce 9800GT OCed to 700/1780/960
Corsair TX750W PSU
2GB DDR2 RAM - 2x 1GB G Skill
500GB Western Digital Caviar Black HDD
Windows 7 RC 7100 and Ubuntu 9.04
MODDED Rosewill R604-P SL mid ATX case
Full system details
How to setup a home server using Ubuntu 9.04
Case mod :D
Image
Image

Return to Home Servers

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.