This action might not be possible to undo. Are you sure you want to continue?
First and foremost, we're going to need a CD with Ubuntu on it. Point your web browser to http://www.ubuntu.com/, and click download from the menu to the left. You will now be presented with a box with two tabs: "Desktop Edition" and "Server Edition". Click the "Server Edition" tab, and select "Ubuntu 8.04 LTS". Next, select a download location from the dropdown box. Finally, hit the "Begin Download" button.
Now you need to burn the ISO (the file that you downloaded) to a blank CD. If you don't know how to do this, there is an excellent guide at https://help.ubuntu.com/community/BurningIsoHowto
Install Ubuntu Server
Now that you've downloaded and burned the ISO, let's get Ubuntu installed on your server. Put the disk in the drive, and boot from the CD. In most modern computers, this will happen by default if a disk is in the drive when you turn it on. If it doesn't, then you need to press a key on your keyboard right when you turn it on. For my laptop, it's F12, and for my server, it's F2. It just depends on your computer. You can find it by looking at the text on your screen right when you turn the computer on, during the BIOS. You'll see something like "Press [KEY] to change boot order". Press that key, and select your CD drive.
Still with me? Good. Now that you've booted up Ubuntu, you should see the following screen:
Select your language, and hit enter. Now you'll see this screen:
You can usually set this to anything. I always choose no. . this will work without complaint. For most cases. Personally. it will ask you for a host name.Select "Install Ubuntu Server". After you've done that. just follow the on-screen instructions to get it working. However. just follow the on-screen instructions. Either option is fine. After it's done with all of that. because it's faster to select a standard american keyboard from the list than to have the installer detect it. the installer will try to auto-configure your network settings. and away we go! The installer will now ask you if you want it to detect your keyboard layout. if it doesn't work for you. during these screens. These should pass quickly and without problems. However. I always set mine to "web-server". you'll now see a bunch of loading screens saying things like "Detecting CD-ROM drives" and such.
it's Pacific. Select "Guided . Now. Choose the one that applies to you. .The system will now want you to set the time zone for your clock. For me. the system will detect more hardware. and you'll be prompted to "partion the disk(s)".use entire disk".
more options will be available here. For most setups. for more specialized systems.You will now need to select the disk you wish to partition. Choose the one that applies to you. . only one disk will be available. however.
The installer will now proceed to format the drive and set up the partitions. don't worry. The system will begin to install. Now the magic happens. However. Just let it do it's thing. It just depends on your system. then yes. if it's stuck on one thing for upwards of an hour.It will ask you if you want to write the changes to the disk. While this happens. Select "Yes" and hit enter. it is frozen. it isn't. There might be times that it seems like it's frozen. go get a cup of coffee. This can take anywhere from 10 minutes to an hour. .
give it your full name and hit "Continue". it needs to set up the account you are going to login with. .Now that the system is installed. First.
Now give it your username. One name you may not use is "root". but you can change it. It will normally just set it as your first name. .
as well as a mixture of the above. . lowercase letters. DO NOT use a password shorter than 7 characters. or your server will not be secure at all. for my servers I use symbols.You will now be asked to provide a password. However. It is ESSENTIAL that you choose a strong password. I recommend at LEAST a mixture of numbers. and uppercase letters.
re-enter your password to verify that you typed it correctly. or leave it blank if you don't use a proxy. Provide it with your proxy information. . and select "Continue".Then. The system will now attempt to configure the "Package Manager" (we'll get to what that is shortly).
The system will now scan several servers looking for updates and configuration settings. .
NOT ENTER. listen VERY carefully. Select OpenSSH server. . Now. the install will proceed without installing the OpenSSH server. but I have no experience with this option. If you hit enter. and press SPACE. so we're going to install it all with a different command later on. You could install "LAMP server" as well. you will be presented with several options to install server software.After that has completed.
as well as other system components. .The system will now install your selected software.
you will be presented with a screen that looks similar to the following: . If all goes well. the install will finish. Remove the CD. The computer will reboot.Finally. and hit enter.
that's the way it was designed to work. As you're typing your password. and your screen should look similar to the one below if all went well: Now. it will ask you if you want to continue. press enter. and then type your password. hit enter. type your username (the one you chose earlier). you won't see anything as you're typing it. Don't worry. To do this. and again. First. Type "y" and press enter. Update Your New Server Before we go any further. type: sudo aptitude update && sudo aptitude dist-upgrade It will ask you for you password. Your screen will look similar to the following: . After you've done that. and it is time to turn this computer into a web server. you'll notice that nothing seems to be happening. we need to make sure your server is up-to-date. Ubuntu is now installed. After you've finished typing your password.Congratulations! You've just finished the hardest part. you need to login.
In additon to the web server. which manages nearly all the . Install Apache. Your server is now completely updated. we're going to need to install a web server (Apache). So. you do not have to enter your password again for five minutes. In order to access your sites from the internet. allowing it to work properly. It runs the command (i. Got all of that? Good. type: sudo shutdown -r now And let it reboot. in that Ubuntu will download and install the programs for you with a simple command. This is also why it asks you for your password. and PHP It is now time to install some programs. This is because Ubuntu has something called a Package Manager. A Quick Note About "Sudo" By now. This is because they require administrator privileges. you may have noticed that all of the commands you have typed have started with "sudo". This will take a while depending on your internet connection. MySQL. your computer will need to be rebooted. we'll also want a database server (MySQL) and a server-side language (PHP) so that we can run popular applications such as WordPress. However. To do this. after you have typed "sudo" once and entered your password. and that's what "sudo" does. "shutdown") as an administrator. Not all commands require sudo. only ones that modify parts of the system.Your system will now download and install all the latest updates. After it has finished.e. let's get to it! Installing programs on Ubuntu is a lot different than installing programs on Windows or OS X.
MySQL will ask you for a root password. During the install process. You can set this to anything. Aptitude will download and install of the programs you specified. To do this.programs on your system. DO NOT leave this blank. just be sure you make it long and secure. All we have to do is tell the package manager (called "aptitude") that we want it to install Apache. MySQL. type the following command: sudo aptitude install apache2 php5-mysql libapache2-mod-php5 mysql-server And press enter. Whatever you do. and PHP. . It will also download and install any dependencies.
To test it out. In my case.129. . If you see the "It works!" message. first find your server's IP by typing: ifconfig | grep inet It's usually the first IP returned.177. it's 192. open your web browser and point it to your server IP. it works. Now that you know the IP.168. you now have a fully working web server. then congratulations.After that has all finished.
First. back up the original Apache configuration file: sudo cp /etc/apache2/apache2.bak Now open the configuration file: sudo nano /etc/apache2/apache2.However. We don't want Apache or PHP to disclose any information about themselves.conf /etc/apache2/apache2. we're not done yet.conf. as this information is not needed by your users and could pose a security risk.conf Scroll down (down arrow) to where it says "ServerTokens Full" and change it to read "ServerTokens Prod" .
scroll down a little further and change "ServerSignature On" to "ServerSignature Off" Finally. That will save the file and exit the text editor.ini.bak . Now. First. back up the original PHP configuration file: sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.Now. we need to do the same thing for PHP. press Control-O followed by Control-X.
restart Apache: sudo /etc/init. To install it: sudo aptitude install shorewall By default. open the "rules" file: . However. Instead. this is not the behavior we want.ini Change "expose_php = On" to "expose_php = Off" Again.d/apache2 restart You are done setting up Apache. allowing complete access. copy the configuration files to the Shorewall directory: sudo cp /usr/share/doc/shorewall-common/examples/one-interface/* /etc/shorewall/ Now. Now that the configuration files are updated. a command-line firewall. we're going to block all connections to anything other than port 80 (HTTP) and port 22 (SSH). press Control-O followed by Control-X. and PHP. First. Shorewall is installed with no rules.Open the configuration file: sudo nano /etc/php5/apache2/php. MySQL. Install a Firewall We now are going to lock down our server a bit more by installing Shorewall.
sudo nano /etc/shorewall/rules Add these lines above where it says "#LAST LINE" HTTP/ACCEPT SSH/ACCEPT net net $FW $FW Then press Control-O and Control-X. The last thing we need to do is tell Shorewall to start on boot. open up the main Shorewall configuration file: sudo nano /etc/shorewall/shorewall. Your firewall is now configured to only accept HTTP and SSH traffic. So.conf Scroll down to "STARTUP_ENABLED=No" and set it to "STARTUP_ENABLED=Yes" .
Press Control-O and Control-X. you cannot write to this folder. my personal favorite. Free). open the Shorewall default configuration file: sudo nano /etc/default/shorewall And change "startup=0" to "startup=1". Add Your Website to Your Web Server Now that you've got everything all set up. and. and made the website folder writable to the members of the "www-data" group. FileZilla (Windows. OS X. Cyberduck (OS X.Press Control-O and Control-X. Some clients that support SFTP are: WinSCP (Windows. Free). Finally. you'd probably like to add a website to it. Now. Now. $30) . Linux. However. Free). Let's make it so you can: sudo usermod -g www-data [YOUR USERNAME] sudo chown -R www-data:www-data /var/www sudo chmod -R 775 /var/www What happened there was you added yourself to the "www-data" group. all of the files Apache serves up to the internet are located at "/var/www/". start your firewall: sudo /etc/init. Transmit (OS X. By default.d/shorewall start Congratulations! Your firewall is now set up and protecting your server. you're going to log into your server using SFTP (not to be confused with FTPS).
I can only give you general directions in this area. a default path of "/var/www" (if it doesn't. Now. it is also a lot more secure than FTP. simply browse to /var/www once you have logged in): (Transmit pictured) You may now add your files to this folder (/var/www) and they will show up on your server when you browse to it with your web browser. There are two ways to open your server up to the internet: a DMZ or Port Forwarding. you may wonder why we're using SFTP instead of FTP. if your client supports it. and makes it difficult (if not impossible) for malicious users to gain access to your login credentials. As I don't have every router available to test with. However. because SFTP is already built into OpenSSH (which you installed earlier). The main difference you'll notice is that with a DMZ. and. Make Your Server Accesible to the Internet Most modern home networks are behind a router these days. your server uses the firewall we installed earlier to . Mainly. Because of this. your web server will not be visible to the internet without a little work.Connect to your server using your username and password.
Again. and you'll be set. To create a DMZ. and look for something along the lines of "Static IPs" or "Static Routing". However. can help you get the job done for almost any router. PortForward. For OS X. Google is helpful in situations like this. and password when it asks for it. However. username. once you login. choose SSH. You'll notice that.protect itself. you're going to want to give your server a static LAN address. find your public IP. After you have given your server a static LAN address. login to your router. add your server to the DMZ. SSH is already installed. Once you find it. it looks exactly the same as the screen on the server: . To do that. The ports that you want to forward are 22 and 80. there is an excellent website. while ugly. with Port Forwarding. your server will be protected by your router's firewall.com. I recommend Putty. and type "ssh you@yourip". To port foward. that. For Putty. and put in your IP. before we go on. Remember. and voila! You can access your server from anywhere as long as your IP doesn't change. Managing Your Server Remotely Beside allowing you to upload files. you need to login to your router and look for something like "DMZ settings". you can do these next parts. Now. Simply open up Terminal. OpenSSH allows you to login to your server from anywhere as long as you know it's IP. Google is your friend. For Windows. you'll need an SSH client.
but hopefully you have gained a little insight into how web servers work. To logout from the server. That's It! You now have a completely functioning web server. MySQL. and PHP Shorewall Configuration Guide How to Port Forward . here are some great guides: y y y y Installing Software Setting Up Apache.You can do anything from here that you would do actually sitting at the server. There is obviously a lot left to be learned. and would even be suitable to host websites with fairly low traffic. simply type "exit" and hit enter. If you'd like to read more on the topics I covered. It makes for a great testing ground.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.