All major web sites have a large server behind them. In this tutorial I will show you how to set up a dedicated Web server (Apache, MySQL and PHP) using that old computer you have lying around the house and some free software.
A quick overview
In this tutorial, we intend to carry out several things:
We will install the Ubuntu Server operating system commonly used Ubuntu because of its ease of use and simple administration. It also has a rather large and very active behind it, which makes getting the support of a breeze. Let
OpenSSH installed on the server. This allows you to manage the server from remote computers.
a Linux (LAMP, Apache, MySQL and PHP) stack will be installed. This provides the backbone that will run your website. It is the industry standard Apache Web server on Unix-based operating systems, is what most web hosts use (Nettuts are using now) And are we going to use. We will install a firewall to protect your server from unauthorized access. To follow this tutorial, we will need a few items: time. Seriously, this process takes time, especially if you encounter problems. Try to set aside an afternoon to follow this tutorial. You may ask why you want to have your own web server. There are several reasons, some of which are: you can have your own testing ground for their websites, with a slight modification, which could hold its own site, and you will learn a lot about Linux / Unix as you go. With that said, let's get started!
Download Ubuntu Server
First, we need a CD with Ubuntu on it. Point your browser to
http://www.ubuntu.com/ left, click on download from the menu. Now be presented with a box with two tabs: "Desktop Edition" and "Server Edition". Click "Server Edition" tab, and select "Ubuntu 8.04 LTS." Then choose a download location from the dropdown list. Finally, hit the "Begin Download."
Now you have to burn the ISO (the file you downloaded) on a blank CD
Installing Ubuntu Server Now that you've downloaded and burned the ISO, let Ubuntu installed on your server. Place the disc in the drive, and boot from the CD. In most modern computers, this will happen by default, if a disk is in drive when turned on. If it does, then you need to press a button to the right of the keyboard when you turn it on. On my laptop, F12, and for my server, is F2. It just depends on your computer. You can find it by searching the text to the right screen when you turn on the computer during the BIOS. You will see something like "Press [KEY] to change the boot order." Press the key, and select your CD drive.
Still with me? Well. Now that you've started with Ubuntu, you should see the following screen:
Select your language and press enter. Now we will see this screen:
Select "Install Ubuntu Server", and away we go!
The installer asks if you want to detect your keyboard layout. Personally, I always choose No, because it is faster to select a standard U.S. keyboard from the list to have the installation program detected. Either option is good, just follow the onscreen instructions. After you've done that, you'll see a lot loading screen saying things like "The detection of CD-ROM" and such. They must move quickly and smoothly. However, during these screens, the installer will automatically configure the network settings. For most cases, this works without complaint. However, if it works for you, just follow the onscreen instructions to run it. After all this is done, you will be a host name. Usually, you can set this to anything, always mine "web server.
The system is to configure the time zone for your clock. To me, it's the Pacific. Choose the one that applies to you.
now have to select the disk you want to partition. For most configurations, have only one disk is available, however, to more specialized systems, more options are available here. Choose the one that applies to you.
will be asked if you want to write changes to disk. Select "Yes" and press enter. The installation program will now format the drive and create partitions.
Now the magic. The system will start installed. While this is going to have a cup of coffee. This may take 10 minutes to an hour. It just depends on your system frozen may be times it seems to be, do not worry, it's not. Just let it do what it is. However, if caught on one thing for more than an hour, frozen, then yes, it is.
Now that system is installed, you must configure the account that you will log in with. First, give your full name and click "Continue."
Now give your user name. Normally, you just set that as your name, but you can change. A name can not use the root is "."
will now be asked to provide a password. It is ESSENTIAL to choose a strong password, or the server will be safe in everything we recommend at least a mixture of numbers, uppercase and lowercase letters. However, for my servers I can use symbols, and a combination thereof. DO NOT use a password of less than 7 characters.
then re-enter your password to verify the correct spelling.
Now, the system searches multiple servers for updates and configuration settings.
After that is complete, you are presented with several options for installing the server software. Now listen very carefully. Select the OpenSSH server and press SPACE, DO NOT ENTER. If you press enter, the installation will proceed without installing the OpenSSH server. You can install "LAMP server" as well, but I have no experience with this option, so let's install everything with a different command later.
The system will install the selected software, and other system components.
Finally, the installation terminates. Remove the CD, and press Enter. The computer will reboot. If all goes well, you are presented with a screen that resembles the following:
Congratulations! You have just completed the hardest part. Ubuntu already installed, and it is time to turn this team into a web server.
sudo aptitude update & & sudo aptitude dist-upgrade
are prompted for your password, and again, you will not see anything like what you're writing. After you've done that, you are asked whether to continue. Type "y" and press Enter. The screen will look similar to the following:
Your system will now download and install all updates. This will take a while depending on your internet connection. After you have finished, your computer must be restarted. To do this, type: sudo shutdown-r
now and let it reboot. Your server is fully updated.
A quick note about "sudo"
For now, you've probably noticed that all the commands you have written has begun with "sudo". This is because they require administrator privileges, and that's what sudo does. It runs the command (ie "shutdown"
as an administrator, allowing it to work properly. This is the reason I ask for your password. However, after writing "sudo" once entered your password, you do not have to enter your password again for five minutes. Not all commands require sudo, the only change certain parts of the system Got all that? Well.
Now is the time to install some programs. To access their web sites, we will have to install a web server (Apache). In additon to the web server, so you'll want a database server (MySQL) and server-side language (PHP) so that we can run popular applications such as WordPress. So, let's do this!
Installing programs in Ubuntu is very different from installing programs on Windows or OS X, just that Ubuntu will download and install programs with a command. This is because Ubuntu has something called a package manager, which handles almost all programs on your system all we have to do is tell the package manager (called "fitness"
we want to install Apache, MySQL and PHP . To do this, type the following command: sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
During the MySQL installation process will ask for a root password. You can set this to anything, just make sure it is long and safe. Whatever you do, DO NOT leave blank.
After everything is over, now has a fully working web server. To prove this, first find your server IP, enter:
ifconfig message, then congratulations, it works.
sudo nano / etc /
apache2/apache2.conf Scroll down (down) where it says "Server Full-token" and change it to read "Prod Server"
Now move down a little more and change the signature "Server" to "Off
Finally, press Control-O followed by Control-X. That will save the file and exit the text editor.
Now, we have do the same for PHP. First, a backup of the original PHP configuration file:
sudo cp / etc/php5/apache2/php.ini / etc/php5/apache2/php.ini.bak
Open configuration file: sudo nano
expose_php = ON "to" expose_php = Off "
Once again, Control-O followed by Control-X. Now that you update the configuration files, restart Apache:
sudo / etc/init.d/apache2 restart
Usted está terminado de configurar Apache, MySQL y PHP.
Instale un Firewall
Ahora vamos a bloquear nuestros servidores un poco más por la instalación de Shorewall, un comando de servidor de seguridad de línea. Para instalarlo:
sudo aptitude install shorewall
sudo cp / usr / share / doc / shorewall-common / examples / interface / * / etc / shorewall /
Now, open the "rules" file:
sudo nano / etc / shorewall / rules
Add these lines above where says "# Last Line" FW
HTTP / ACCEPT net income of U.S. $
FW SSH / ACCEPT net income of U.S. $
Then press Control-O and Control-X. Your firewall is configured to accept only HTTP and SSH traffic. The last thing we need to start to do is tell Shorewall to start. Therefore, open the main configuration file Shorewall:
sudo nano / etc / shorewall / shorewall.conf
Scroll to "STARTUP_ENABLED = No" and put "STARTUP_ENABLED = Yes"
Control-O and Control-X. Now, open the default configuration file Shorewall: sudo nano / etc / default / shorewall
And "change of start = 0" to "start = 1." Control-O and Control-X. Finally, start the firewall:
sudo / etc / init.d / shorewall
Congratulations! Your firewall is configured and the protection of your server.
Add your website to your web server
Now that you have everything all set up, you probably want to add a website for it. By default, all Apache files are served to Internet in / var / www / ". However, you can not write to this folder. Let's make it so you can:
sudo usermod-G www-data [YOUR USERNAME]
sudo chown-R www-data: www-data / var / www
The happened there was that added to itself the "www-data" group, and made the website folder writable by members of the "www-data" group.
Now, you will access your server using SFTP (not to be confused with FTPS). Some clients that support SFTP are: WinSCP (Windows, free), FileZilla (Windows, Linux, OS X, free), Cyberduck (OS X, free), and my personal favorite, transmission (OS X, $ 30)
Connect to your server using your username and password, and if the client supports it, a default path "/ var / www (if you do, just go to / var / www Once you have logged in): (passed in the photo)
Now you can add files to this folder (/ var / www) and it will appear on the server when it comes to it with your web browser.
Now, you may wonder why we are using SFTP instead of FTP. Mainly, because SFTP is already built into OpenSSH (which you installed earlier). However, it is much more secure than FTP, and makes it difficult (if not impossible) for malicious users to access their data access.
Making the Internet accessible server
Most modern home networks are behind a router these days. Because of this, the web server will not be visible to the Internet without a little work. As no test available to all routers, I can only give general directions in this field.
There are two ways to open the server to the Internet: a DMZ or port forwarding. The main difference you'll notice is that, with a demilitarized zone, the server uses the firewall that was installed earlier to protect himself. However, forwarding ports, the server will be protected by the firewall router.
However, before you continue, you will want to give your server a static Internet address. To do this, log into your router, and look for something along the lines of "Static IP" or "Static Routing". Having given your server a static Internet address, you can do these next parts. Remember, Google is your friend. Al port foward, is an excellent website, PortForward.com, that, while ugly, can help get the job done for almost any router. Ports to be forwarded are 22 and 80 To create a DMZ, you need to access your router and look something like as "demilitarized zone settings." Once you find it, add the server to the DMZ, and you will be established. Once again, Google is useful in situations like this.
Now finding your public IP, and voila! You can access your server from anywhere as long as your IP does not change.
Manage your server remotely
addition to allowing upload files, OpenSSH lets you connect to your server from anywhere as long as you know is copyrighted. For Windows, you'll need an SSH client. I recommend Putty. For OS X, SSH is already installed. Just open Terminal and type "SSH @ ip. To putty select SSH, and put in your user name IP and password when asked. You will notice that once you connect, it looks exactly like the screen on the server:
That's it!
now have a fully functional web server. It becomes a great testing ground, and even be appropriate to host web sites with a fairly low traffic. Clearly there is much to be learned, but hopefully you have gained a little insight into how web servers work.
although the images are in English but nu ahy be guided and encouraged if it works and the source is Villmann Alex is a yanquee but this piola
comenzemoss
0 comments:
Post a Comment