Linux LAMP Server

Computer, Linux, TTOS, Tutorials, Tutorials

 

Have you ever wanted to start your own web page? Or set up your own database

server? Or maybe serve content across your own home network? Well, hereis

where to start!

 




First, we are going to start with a fresh install of a Debian based
distribution. In this example, I used TTOS Linux 1.0 PR4 (A Debian 7.x
Distribution). I would recommend a headless Debian 8.x for this project on a

dedicated machine. Once the install is complete, we need to update the
repository, and the installed packages. We do this by entering root…

User$ su

(if this does not work, try “sudo su”)

Once logged in, issue the following command to start the update process….

# apt-get update && apt-get upgrade

MySQL
Next, we install mysql by issuing the following commands as root…

# apt-get install mysql-server mysql-client

NOTE: You will be asked to input a root password for your database. Write
this down because you will need this for your server.

Apache2
Apache is the Web Server. It feature list is extremely huge, and it is fairly
easy to set up (including virtual hosts). It is installed by issuing the
following commands as root…

# apt-get install apache2 apache2-doc

Enable user directories for Web Server
# a2enmod userdir

Configure user directory module..
# nano /etc/apache2/mods-enabled/userdir.conf

And edit to read the following…
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root

<Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>

Create directory as normal user…
$ mkdir /home/USERNAME/public_html

Change group as root
# chgrp www-data /home/USERNAME/public_html
# chmod 755 /home/USERNAME
# service apache2 restart

Now we move on to PHP.
Issue the following command as root…
# apt-get install php5 php5-mysql libapache2-mod-php5 phpmyadmin

Now we need to test that our Apache server and PHP is functioning… We do
this by typing the following as root…
# nano /var/www/html/php-test.php

And insert the following code and save…

<?php phpinfo(); ?>

After this is done, go to another computer, open a web browser, and type
“http://<SERVERIP>/php-test.php” into the address bar and it should give you a
PHP version information page.

And that is it! From here, you can create and host a blog, an online store
front, a business page, the next social media web site, and more! Please
subscribe to our RSS feed or e-mail news letter to be notified of our next
tutorial…. “Open your own online store in these easy steps!”

 

17 comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.