Prepare Ubuntu (or another distro) for web development

Beyond the myths, beliefs or the opinion that GNU / Linux is complicated to use, I consider it to be an excellent Operating System for those who are developers, especially web developers.

I have had the opportunity to converse with many people who prefer OS X and even Windows to develop, as they say, because of its ease and its tools, and although it is a very individual opinion of each person, I believe that any GNU / Linux distribution or at least the most popular ones, offer everything you need to install and work.

[quote] The most popular distributions offer all the necessary packages in their repositories for a web developer. [/ quote]

Now, on the development issue there is a dilemma, is a very updated distribution like Antergos or one that maintains a balance between stable and up-to-date as Ubuntu?

I put a very simple example, while in Ubuntu Trusted the latest version of Netbeans is 7.0.1, in ArchLinux version 8.0.2 is available. The same thing happens with NodeJS and other packages that we will see below that are widely used by front end.

Anyway, it is everyone's decision to choose the distribution of their preference according to the work to be carried out. For this article, we will start from an Ubuntu installation, and since it is focused on new users, we will show the process step by step.

Install Ubuntu 14.04

The first thing we will do is download the Ubuntu installation image from its official website. The link below will allow you to choose whether to download a 32-bit or 64-bit iso.

Download Ubuntu

Once we download it, we must "burn" a DVD with the downloaded iso or prepare a Flash memory to boot and install from it. In Windows we can do it by following this guide and on Mac This other. Once this is done, we restart the PC and start through the memory or the DVD.

Ubuntu 14.04 installation steps

If you are not sure how to install Ubuntu without losing your data, you can install it using a virtual machine in VirtualBox or back up all your data in a safe place, if possible, to an external disk

The first thing is to select the language with which we want to install Ubuntu:

Ubuntu Developers

Later we will see if we have all the necessary requirements for the installation:

Ubuntu_Development2

Later we go to partitioning the hard drive. If you are not experienced with this, it is preferable that you leave everything as default once you have backed up your data.

Ubuntu_Development3

We choose the time zone:

Ubuntu_Development4

We choose the language of our keyboard:

Ubuntu_Development5

We define our username, the name of our computer, our password:

Ubuntu_Development6

And we wait for it to finish:

Ubuntu_Development7

Once the installer finishes, we restart the computer and enter our session. We can run the Update Manager or open a terminal and put:

$ sudo apt update && sudo apt upgrade

And if there is nothing to update, we can start.

Preparing our workspace for testing

So, as we are developers, we only want to focus on what we know how to do: develop. We are not interested in knowing how to configure a web server, or how a database works, we just want something that works and is easy to implement to start writing code.

If we only had to write in HTML, CSS, JS, everything would be simpler, but sometimes we must have a test server for code in PHP, Ruby, DJango, etc. Therefore, it is best to set up our own web server. Luckily for us we have this facility in two different ways:

  1. Using the installer XAMPP what provides us Apache.
  2. Using LAMP Bitnami.

Installing Bitnami

The LAMP installation via Bitnami we already saw it in a previous article, therefore it will not be necessary to address it in this article. Once Bitnami is installed, we can manage our test server through the web browser.

Bitnami

All the necessary documentation on how Bitnami works can be found at his wiki.

XAMPP installation

The XAMPP installer also comes from Bitnami, but the installation process is somewhat different, so we will see it step by step. The first thing of course is to download the file that interests us according to the architecture of our processor:

XAMPP 32 Bit
XAMPP 64 Bit

Once downloaded, we open a terminal and access the folder where the file is, to which we will give execution permissions. In the case of the 64 Bit file it would be:

$ sudo chmod a+x xampp-linux-x64-5.5.19-0-installer.run

Now in the same terminal we execute it:

$ sudo ./xampp-linux-x64-5.5.19-0-installer.run

And we follow the following steps.

It is advisable to accept everything as it comes by default, for this we only have to give the Enter

XAMPP

In the previous image it asked us if we wanted to install the files for developers and in the later one, if we agree with the selection we chose.

xampp1

Now it asks us the path where we want to install (by default it is in / opt / lampp), and although we can change it, I recommend leaving it as is.

xampp2

One more step of verification before starting to install

xampp3

Installing XAMPP

xampp5

Installation completed.

xampp6

Now, to start XAMPP we just have to execute:

$ sudo / opt / lampp / lampp start Starting XAMPP for Linux 5.5.19-0 ... XAMPP: Starting Apache ... ok. XAMPP: Starting MySQL ... ok. XAMPP: Starting ProFTPD ... ok.

And this way we already have our Apache + MySQL + PHP + Perl server running. If you have a problem, I recommend that you visit the FAQ.

Custom DNS and Virtual Host with XAMPP

Assuming that we have several sites hosted on our test server, we can set each of them to be viewed locally in the file / Etc / hosts. Let's take an example, let's say we have the site dev.tests.com, what we do is open the file / Etc / hosts with our favorite text editor (and as root) and add it in the following way:

$ sudo vim /etc/hosts

and we add the line:

127.0.0.1   dev.prueba.com

But of course this is not enough, because we have to tell Apache that when someone makes a request to dev.test.com For 127.0.0.1, you have to return our test site.

We edit the file /opt/lampp/etc/httpd.conf

$ sudo vim /opt/lampp/etc/httpd.conf

and uncomment (removing the pound sign) the line that says:

# Include etc/extra/httpd-vhosts.conf

and we leave it like this:

Include etc/extra/httpd-vhosts.conf

Now we go to the file /opt/lampp/etc/extra/httpd-vhosts.conf which should have something like this:

# use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias ​​in any block. # ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/opt/lampp/docs/dummy-host.example.com" ServerName dummy-host.example.com ServerAlias ​​www.dummy-host.example.com ErrorLog "logs / dummy -host.example.com-error_log "CustomLog" logs / dummy-host.example.com-access_log "common ServerAdmin webmaster@dummy-host2.4.example.com DocumentRoot "/opt/lampp/docs/dummy-host80.example.com" ServerName dummy-host80.example.com ErrorLog "logs / dummy-host2.example.com-error_log" CustomLog "logs / dummy-host2.example.com-access_log" common

We modify it and leave it this way:

# use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias ​​in any block. # DocumentRoot "/ home / path / folder / project /" ServerName my_blog.dev Require all granted

Obviously, the path to our project folder must be specified when replacing "/ Home / path / folder / project /".

Manual LAMP Installation

Now, although it may not seem like it, I think it is more cumbersome to do the installation in the previous way than installing the packages directly from our repositories. To have the same Stack on our PC we just have to open a terminal and put:

$ sudo apt install apache2 mysql-server-5.5 phpmyadmin

With these 3 packages only, the necessary dependencies will be installed to start working with the minimum required when developing.

Custom DNS and Virtual Host with LAMP

On the part of the DNS (Domain Name Server) we keep everything the same, that is, we add the names of our test sites in the file / Etc / hosts. Now, in the case of Apache, the path of the VHost (Virtual Hosts) is different.

Normally what is done is to place what we put in the file /opt/lampp/etc/extra/httpd-vhosts.conf in the route /etc/apache2/sites-available/vhostname.conf, and then a symbolic link is made to that file in the folder / etc / apache2 / sites-enabled / but we are not going to complicate. We will directly put the file in / etc / apache2 / sites-enabled / with the following configuration:

$ sudo vim /etc/apache2/sites-enabled/dev.pruebe.com.conf DocumentRoot "/ home / path / folder / project /" ServerName my_blog.dev Require all granted

I think it is valid to clarify that when we install manually, the default path of the website folders is / var / www / http /.

NodeJS and Ruby installation

If we use NodeJS o Ruby (instead of PHP and Perl) we can manually install the packages by running in the console:

$ sudo apt install nodejs ruby

And if they need any more packages, they just have to search for it by running the package manager or in the console:

$ sudo apt search paquete a buscar

Until this part we already have the server-side part ready for our sandbox, now let's see some of the applications that we can use.

Web development tools

In the repositories we have some applications that will allow us to work comfortably when it comes to HTML, CSS, JS and others. Among them we have:

  • Bluefish
  • geany
  • Gedit
  • Kate

Being bluefish (in my opinion) the most complete when it comes to work front end, but I recommend installing third-party applications that offer us much more functionality. We have for example brackets, SublimeText o Komodo-Edit. All these applications have their own installation package for Ubuntu, except for Komodo-Edit, which you only have to unzip and run a .sh file.

(… in process …)


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   dhunter said

    Does anyone else see a ghost bat in the goat image from this version of ubuntu?

    1.    elav said

      Hahaha it's true .. looking only at the orange beard and the hollows of the muzzle 😀

    2.    Ivan Barra said

      Now that you mention it… that's called "Pareidolia."

      About which Distros to choose when programming is quite complicated. "Formerly" it was developed for a couple of browsers and voila, because the development was much slower. Today, there are an infinity of browsers and platforms on which to develop WEB applications, call it ASP.Net, PHP, JAVA, etc. where the applications are much more transversal, I mean by this, that they are not only accessed from typical desktop or laptop computers, but they are already done (and the same functionality is wanted) from a tablet, mobile, etc.

      I believe that today it is necessary to stay at the forefront, safeguarding first of all the stability and security of the applications, in that sense I am paranoid, it still costs me a lot to carry out, for example, a banking transaction from the other device that is not mine , many times I hope to get to the safety of my home to do so, even if it sounds illogical.

      The other. Let's be honest: it is well known that most programmers (at least the ones I know), whether they are web, JAVA, BB.DD, etc., at least 80% use a Unix platform to program. People who without all the tools that are offered on the platform, openly and free, would be very complicated when moving forward. Also, I can say for sure that almost the entire WEB platform, or BB.DD. it is mounted on a Unix server, therefore wouldn't it be logical for the other part to work the same way?

      Thanks for sharing and greetings.

    3.    Batman said

      Shut up… i'm Batman!

    4.    neysonv said

      Looks like an owl to me lol

      1.    elav said

        That's right .. here we think the same after looking again

  2.   Hugo Santos said

    I am a web developer mainly PHP, I have been using Debian as my work environment for several years, as they comment in the post, the decision of which distro to use depends on each person, and in the Linux development area if it provides a large number of tools that make life easier.

    Just as a comment, I have seen in many places that some developers install XAMPP, LAMP and / or the like, in Linux it is not necessary to do that since we remember that apache is native to linux, for example I only install apache2 and php5 on my Debian with the typical one (aptitude install apache2 php5) and voila, I no longer have to do anything other than put my projects in / var / www

    1.    elav said

      That's right, what happens I tried to do it "easy", although in the post I mention the two methods 😉

    2.    Tecno-Integra Automation said

      Regards. That seems fine to me that you install apache2 and php5, but I feel like you would need to put mysql and also How do you configure phpmyadmin? Thank you.

  3.   Marcos_tux said

    Let's be honest, despite the effort Dreamweaver goes over all those programs, it is a shame but in Linux we do not have something at the height of this Adobe program.

    1.    eliotime3000 said

      Yes there is (well, partly), it's called Brackets and it also considers Vim and Emacs. : v

    2.    That dumpster called Dreamweaver said

      Putting garbage in the code of course Dreamweaver passes everyone by

    3.    Hernán said

      Dreamweaver is more for designers than for programmers, for people who work with code it is too cumbersome and slow. It is much more comfortable to use a program like sublime text, brackets or webStorm / phpStorm. The times I used Dreamweaver I had problems, after leaving my code ready, I went to design mode, where if I put a point or move something, Dreamweaver takes care of completely disassembling my code that I had left so neat. Not to say that it is payment. I have designer friends and for them it is fantastic, since they can make a page without writing a single line of code.

      1.    Eduar said

        breamweaver Hahaha I will never learn with that if you will learn to clip

    4.    KZKG ^ Gaara said

      Dreamwho?… Baff, buddy, Artisteer, Dreamweaver, all those are pure bullshit, sorry to say it like that but it's the truth.

      They put seven hundred lines of junk code, lots of tags or goals that are not needed, etc etc etc.

      Brackets, Sublime, with any of these is more than enough to do any CSS job.

    5.    kdexneo said

      Aptana Studio 3 much better than Dreamweaver.

    6.    elav said

      What did you say? Dreamweaver? And soooo queee essss?

    7.    sherpa90 said

      Hopefully you see all the garbage code that generates you ... dreamweaver is for NON-PROFESSIONALS, period!

  4.   hazama said

    Sensational post, really
    Congratulations

    1.    elav said

      Thanks

  5.   peterczech said

    Your info is very useful… Thank you. Are you going back to Ubuntu / Debian waters?

    1.    KZKG ^ Gaara said

      HAHA he always keeps a space in his heart for Debian, but… Ubuntu I don't think so hehehe

      1.    peterczech said

        You never know 😀 😀

    2.    elav said

      Although it should never be said NEVER, I really don't think I'll be going back to Debian for a long, long, long time.

  6.   Celsius said

    Poor tomcat nobody wants it.

    1.    elav said

      Who wants Java? 😛

  7.   Gabriel said

    I think the themes are getting confused (again), there are you who are only designers, others who are only programmers, there are both, there are those who see winbug "easy" because they install next next and "all set" ( implying that they may or may not be working with proprietary and / or licensed software), there are those who are a little more advanced (and "brave") and also know about linux and normally work with the tools they find in between, and thus a long etc, as we are sharing in this blog the idea is that one develops on gnu-línux whatever the distro it is and therefore opensource tools are used, the underlying issue (I think) is that it depends on each person, there are tools that we don't even know but when we want to learn we have to invest a few hours until we give it, and if we feel comfortable (regardless of what others think) we will be happy !! (:

    1.    rlsalgueiro said

      you can also download the version for php5.6.3
      http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.3/xampp-linux-x64-5.6.3-0-installer.run
      http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.3/xampp-linux-5.6.3-0-installer.run
      It depends on what you are developing or the compatibility you need, to keep version 5.5 I simply install the packages that are in the repo and that's it, I have apache 2.4, php5.5.13 etc. also the other libraries like phpcs are easy to install, it is clear that I like the shell and I prefer to install and configure all the things that I can.

      1.    rlsalgueiro said

        You have seen this project wpn-xm.org, it would be interesting to achieve something like this for linux, I say integrated because I use some of those tools, and I am sorry to say that despite its large number of libraries and that the hostings are almost all mounted on Apache I have changed for nginx. I found wpn-xm looking for alternatives to LAMP and XAMPP and it is good for the work machine. It is undoubtedly a good alternative. by the way sorry for my previous comment on W $ + chrome

  8.   Raul casari said

    Your contribution is very interesting, keep developing it, it is appreciated

  9.   michael cardoza said

    Hello I am new to Ubuntu, I have always used windows but I am wanting to migrate to a linux environment using Ubuntu but when I want to create folders or put files in the htdocs as in windows it does not allow me or there are some things that by custom in windows I could do but in Ubuntu I can't make it block a lot or it doesn't allow me to make modifications, if I use sublime to create files in htdocs it doesn't allow me either, if you can help me, I would appreciate it.

  10.   Coat said

    Someone can help me?
    Many years ago I took a small course in web design and I loved it, and although they gave me the programs for windows, they never let me install them.
    A few months ago I was finally able to switch to Linux Ubuntu and I can't find any programs
    I remember that in the course I saw three programs
    Dreamweaver, Flash MX and another one that was for photo retouching but I can't remember the name.
    Could you indicate download websites or routes to install the equivalent of what I saw in the course?
    All the best
    Thank you.