Join Jon Peck for an in-depth discussion in this video What is Linux, and why should I use it?, part of Learning Linux for PHP Developers.
I've been discussing web development and hosting in increasing amounts of detail. Most web servers use Linux as an operating system. And we're going to be using Linux in this course as well. With that said, before you start using any tool, having context about what it is and why it is being recommended will deepen your understanding of the system that you are using. Blindly repeating actions without being able to question or justify why isn't learning. Therefore, let's explore what Linux is and why it's a good option for development. Let's step back and answer a different question first.
What is an operating system? In the purest sense, it's software needed to run programs on a computer. Common examples of operating systems include Microsoft Windows and Mac OS. An operating system manages the computer's hardware as an intermediary. Meaning programs only need to know how to talk to the operating system, not how to work with the CPU or other peripherals. Additionally, an operating system provides common services, such as user interactions through a graphical user interface or command line. They also have the ability to manage programs by performing tasks such as installing, running, stopping, and so forth.
With that context, Linux is a free and open source operating system. That doesn't necessarily refer to the price of the software. To quote the Free Software Foundation. Then of free, as in free speech, not as in free beer. Linux is available on most computer hardware platforms. Young and old, off the shelf to hand-built. In fact Linux is the leading server operating system in the world, and that's no small feat. I mentioned free, and open source software explicitly before, as that's a core value that has lead to the development and spread of Linux.
Free and open source software is a movement by the GNU Project. Yes, I'm pronouncing that correctly. Free is an interesting term. In this context, it means freedom to copy, edit and distribute both the source and the program itself. This empowers users to change the software to fit their needs, the ultimate in flexibility. Open source explicitly refers to the source code that's is available to read and modify. The advantage of open source software, is that it takes a collaborative process of a group of people to develop and maintain software.
So that sounds good in concept, but why does it matter? Well, coordinated collaboration results in a much stronger product than the efforts of an individual or group with only one perspective. Also, the free aspect can minimize or eliminate the direct financial cost to the use of the core software. As someone who works almost exclusively with open source technologies. I can tell you that the true cost of free and open source software is time. What is your time worth? Free and open source software also offers a wide variety of components to build upon.
If you have a problem, there's a strong probability that you're not the only person who's ever tried to find a solution. While you may not find a particular tool that does everything that you need, there's a wide variety of enterprise grade software for you to use that is peer built, reviewed, and designed. This allows you to focus on developing your own core product rather than reinventing the wheel. Finally, this freedom also has fostered a large community support base. You can reach out to others in a variety of ways, both online and offline. Search engines, wikis, forms, internet relay chat, meetups, and conferences all help to share and increase knowledge.
Saying you use Linux is like saying you're using a car. There isn't just one flavor of Linux. The general term actually encompasses hundreds of variations known as Linux distributions. A distribution is a combination of software that adds functionality to Linux. Distributions are typically packaged for specific purposes. For example, a desktop distribution intended for end users would typically include a graphical user interface and user applications, like an office suite and Internet browser. In comparison, a server distribution typically has no graphical user interface, comes with a lot less software, and is easy to configure for a specific purpose.
There are many distributions available for both organizations and companies. Some are completely community-based, while others have a commercial component in the form of support or custom development. There are hundreds of different Linux distributions available that are in active development. Each with their own specialization, focus, or advantages. Let's take a brief look at some of the most popular, and well supported distributions. OpenSUSE, Fedora and Ubuntu, which we'll use as the basis of our server. OpenSUSE is the fifth most popular distribution, according to DistroWatch.
Intended to be easily accessible, both in terms of acquisition and use. Variants have been developed since 1994 when it was formally known as SUSE Linux. OpenSUSE is a community program sponsored by Novell. It drew criticism from principle Linux architect, Linus Torvalds, for usability issues. Especially around security policies requiring root credentials to perform everyday operations. Fedora is a general purpose Linux distribution, and the third most popular Linux distribution according to DistroWatch. Fedora has been developed since 1995, when it was known as Red Hat Linux, and has been split into community and commercial additions.
Fedora has a very short life cycle of only 13 months per version which can be very disruptive for those who are trying to rely on support for a particular version. In comparison Ubuntu does not suffer from the same sorts of problems. Ubuntu is focused on features and support, making it very easy to use and build upon. Ubuntu is a fork or derivation of the Debian codebase which has a very long legacy. It's the second most popular distribution only to Mint, which is a desktop-only fork of Ubuntu. Ubuntu is sponsored by Canonical, which makes money selling support options for it.
Ubuntu has a very regular release cycle of every six months. Sounds short, well Ubuntu also has long term support versions with at least two years of support. Ease of use, community and commercial support, and popularity are along the major factors that guide to the decision to use Ubuntu for our development server. Given all this context, it should be a little bit clearer about why Linux is well suited as a web development server. Linux distributions are purpose-built with roles such as desktop or servers including web development.
There are many tools already built-in or readily available for installation to extend Linux. Linux is easy to configure for specific purposes. While in comparison, your existing operating system may feel like a bit of a square peg in a round hole. Not a good fit when you try to do something that it wasn't designed for. Linux and Ubuntu specifically, have great support in the forms of documentation, knowledge basis and communities. Chances are that you weren't the only person with that problem. So look around if you have a question. And finally, best of all Linux is free for collaboration, building and sharing.
I can't think of a better foundation for building web applications.
The demonstrations are performed with the Ubuntu LTS distribution of Linux, but the skills taught here are also applicable to other Linux distributions. Every command is described in detail in context, and a comprehensive quick reference is provided for convenience.
- What is Linux, and why should I use it?
- What's a LAMP, and why does it matter?
- Creating and configuring a virtual machine
- Working with the Linux command line
- Configuring the servers, including Apache virtual hosts
- Building a development server dashboard
- Using PHP package managers like Composer and PEAR
- Installing Drupal, WordPress, and more on the server
- Self-hosting Git repositories, including a web interface
- Enhancing the server with debugging and profiling
- Exporting a virtual appliance to use on another machine
- Server troubleshooting techniques
Skill Level Beginner
Q: The pecl installation of uploadprogress fails, saying it is not a valid package archive. How can I install uploadprogress?
A: There is a bug in Ubuntu's pecl that was introduced after the course was recorded; the workaround command is "sudo pecl install -Z uploadprogress"
Q: Where can I get the exact versions of the software used in this course?
Q: In Windows, git operations ask for a password. Why?
A: Make sure that pagent (PuTTY agent) is running and has the private key loaded. See Chapter 3, movie 4 for details.