Steps needed to set up a web server Apache in Ubuntu desktop


I'm running Ubuntu 14.04 desktop ed. I'm about to set up LAMP. I wonder what would be the correct order of steps that should be taken. I've already got a static IP from my ISP.

My idea would be as such:
1) To set up a static IP in Ubuntu and router. To cancel DHCP in both Ubuntu and the router;
2) To configure a Firewall in Ubuntu;
3) To update registrar's DNS entries for my domain name (hostname). I already has both the registrar and my site's domain name. To input my ISP's two DNS servers' IP's and to update my hostname's A record by inputting my static IP into it. Probably I should also update other records if needed CNAME for www. and MX for MTA;
4) To install LAMP stack (I would need HTTPS, so do I need to make sure that Open SSL is being installed too OR it's done automatically by default?);
5) To place my script's files (in my case it's Joomla) into an approprate Apache's folder (probably www, I think);
6) To set up SSL on Apache.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zephyr ICTCloud ArchitectCommented:

First off: There's a lot of questions here, you'd be better splitting them up, also add more topics to your questions so it will be exposed to more experts.

That being said, let's get you going.

1) The way it will work is that the static IP you get from your registrar is set on your router and is hence reachable from the outside. On your server you set an internal fixed IP and make sure it can be reached by your router. On your router you will be doing what is called port-forwarding. This means that when someone connects to your external static IP (or domain name that is resolving to your static IP) on port 80 or 443 it will be forwarded internally to your webserver.

< Pressed Submit by accident >
Zephyr ICTCloud ArchitectCommented:
2) Make sure to leave all necessary ports open (80, 443, 22)
3) Yes, or do it at a later time, just make sure you can connect to your webserver port 80 using your external static IP (See step 1)
4) You'd do this step before anything else really, first make sure everything is installed, ports are opened in the firewall, etc. (to install ssl with LAMP, check here
5) You can set the directory like you want in Apache but usually for lamp I think it's something like /var/www
6) Don't forget to get certificates for your domain/host/other ... Depending on your setup.
Kanti PrasadCommented:

Here is the sequence

1. As domain name and name server is configured

2. install Apache
      # sudo apt-get update
      # sudo apt-get install apache2

3. type  to test your installation

4. install MySQL
      # sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

5. install MySQL system tables
      # sudo mysql_install_db

6. Make  MySQL installation  secure
      # sudo /usr/bin/mysql_secure_installation
7. install PHP
      # sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

8 . add index.php to the directory index file directive
      DirectoryIndex index.php index.html index.cgi index.php index.xhtml index.htm
9. setup firewall

10. get certificates

11. place a test file in web root directory and test it

below links will guide you.
papakotaAuthor Commented:
Thank you both for your replies!

spravtek, I don't think I can add more topics to my original post after it's been published, but I'll keep it in mind for the future. That's first. I don't get static IP from the registrar (GoDaddy only kinda leases me the domain name), IP I get from the ISP. I probably won't use your link's info, since it's mostly for CentOS. That's second. I know that I can create more topics to discuss about every single aspect, but the whole idea here is to figure out the road map if you will. Kinda step by step algorithm. That's third.

Kanti Prasad, 2 links out of 3 are about Firestarter firewall, and I plan to use ufw (even more likely it's gonna be  its GUI front-end Gufw). But thanks anyhow!

Now, before I grant you your points let me summarize what's been said so far. If I'm wrong about something, please do let me know ASAP.
1) I'd update registrar's A-record and DNS servers (CNAME and MX is really less important at this time). I know that this step can wait, but, as you know, DNS propagation does take awhile, so why waste time?
2) I enable the firewall and open all necessary port in it.  Then I install LAMP and test localhost to make sure it's working. Here's an unclear part though... Is it better to install LAMP first and after that enable the firewall and open the ports OR... to finish with firewalls preparations and then proceed to LAMP installation?
3) I already has the SSL cert from COMODO. Like I said, I had used it when I had been using hosting platform for my site. In the future I think to switch to free SSL cert wosign. It's a Chinese free SSL, but they do work. Okay, back to business. After I install LAMP, I make all the configurations in Apache. Let me ask you something here... The root folder of Apache (or public_html/htdocs folder if you will) by default is /var/www, but I know that some people create a subdirectory (like /var/www/mysite1) and another one (like /var/www/mysite2). Then they get in URL something like and, but it's something that I do NOT want. I want to have a normal URL like My question here is... during LAMP installation, would I have to make those decisions OR... one configures that stuff after the LAMP is fully installed? See... What I want is this:
I usually have a main domain, but I use only a few subdomains (sub-folders) as DIFFERENT sites. Like http://   etc.
4.) I install SSL on Apache;
5.) I test Apache with, says, Joomla.

Kanti PrasadCommented:
Hi Papakota

1. complete step 1 if you can
2. Install LAMP
3. sudo apt-get install gufw  -- Install Gufw GUI
                        ( here you can allow or block preconfigured services and user-specified ports )
4. go with default setting -- if you change your mind the read --Changing the default localhost folder below  
4. yes   Apache and then SSL
5  You can test Apache also as soon as you install by typing or http://localhost  on the address bar

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.