📜 ⬆️ ⬇️

Debian 6 + LAMP local server from testing

Many PHP developers use recognized programs like Denwer, Xampp, WampServer and others as a development environment. But often these programs make it impossible to develop a project in a native habitat. That is, on linux servers. However, this problem can be solved quite simply, it takes a little time and the Internet is at hand. As a result, you'll have on hand LAMP server to work. So, let's begin.

What do we need?

After downloading and installing VirtualBox, we will conduct a not tricky manipulation of the network settings, so as not to return to this issue in the future. Immediately make a reservation that I am doing the installation and configuration on Windows 7 Pro x64. Continue by doing the following:
Start -> Control Panel -> Network and Internet -> Network and Sharing Center
Then in the field “View active networks” go to the properties of the active network. In the "Access" section, you enable sharing for the VirtualBox Host-Only Network. In response to this action, we will receive a notification that our local network card has been assigned the following IP address: 192.168.137.1

Now we’ll make changes to the VirtualBox settings, for this you need to start it and do the following:
File -> Properties -> Network -> Poke a Screwdriver
We check that the IP address is 192.168.137.1, I also advise you to disable DHCP.
All this software preparation is complete. Getting Started Installing Debian. I see no reason to describe the installation, everything is trivial there with the exception of a few points:

Oh yeah, I almost forgot. Before you start installing Debian, in the main VirtualBox window, click on Properties (orange gear) and select the network item. Change the connection type to the virtual host adapter , then in step change the adapter type to PCnet-FAST III and finish by pressing Ok .

Installing LAMP from the testing version.
First, you need to specify the server from which we will install the necessary packages.
Note: all commands imply using sudo before a command!
')
We will perform a standard ritual for the newly installed distribution.

apt-get update
apt-get upgrade


Well, start.

vi /etc/apt/sources.list

Add testing server

#TESTING
deb http: //ftp.ru.debian.org/debian/ testing main non-free contrib
deb-src http: //ftp.ru.debian.org/debian/ testing main non-free contrib


Now you need to set priorities for downloading updates and installing packages.

vi /etc/apt/preferences

create preferences file, fill it with the following contents:

Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=testing
Pin-Priority: 650


All the same magical actions

apt-get update
apt-get upgrade


But the packages will not be updated on the testing version, the whole "fault" Apt-Pinning.

The apt-get install apache2-mpm-itk offer us to install the version from stable, but the goal is different.

apt-get install apache2-mpm-itk / testing seems to suggest installing the version from the testing branch, but there will be many incompatibilities of the packages. To do this, use the following command:

apt-get -t testing install apache2-mpm-itk

I want to immediately notice! The installation process is likely to fail

E: Failed to perform online perl configuration. For details, see man 5 apt.conf about APT :: Immediate-Configure. (2)

To solve it, do the following:

apt-get install perl -o APT::Immediate-Configure=false

Now you can continue the installation.

apt-get -t testing install php5
apt-get -t testing install mysql-server
apt-get -t testing install phpmyadmin

These three commands involve all the necessary dependencies for normal server operation. And it is performed individually in sequence. I came across the fact that

apt-get -t testing install apache2-mpm-itk php5 mysql-server phpmyadmin may have unsolvable dependencies.

Next, install the package vsftpd

apt-get -t testing install vsftpd

In general, now we have all the necessary minimum for working with a web server. But it is not yet configured. Here is what we need for this:
  1. Configuring / etc / apache2 / sites-available / default
  2. setup /etc/php5/apache2/php.ini
  3. configuration / etc / vsftpd.conf


I will not give a detailed setting of the listings, it is beyond the scope of this article, which is no longer small. I will cite just a few tips:


Now I will tell why we manually set the IP address for the server. For local access to the site on VirtualBox, we need to edit the hosts file in our Windows. Let's enter there

192.168.137.5 *.dev

Now you can freely create virtual domains in the zone .dev and work with them through the browser.

I note that site.dev should also be registered in / etc / apache2 / sites-available / default in the ServerName parameter. That's basically it. Now we can upload files via FTP to our new server and will have access to it by accessing site.dev. That's how we got a fully functional server for local development with the latest server software packages. It is also easy to install new packages that you may need for more comfortable development. For example, developers can perform

apt-get -t testing install memcached php5-memcache

and in their hands a powerful caching tool appears.

The following sources were used to write the article:
Apt-pinning
Bug fix with perl
Well, your own experience

Thanks for attention. I will be glad to hear criticism and suggestions.

UPD: thanks inkvizitor68sl for the amendment to edit the hosts file

Source: https://habr.com/ru/post/128698/


All Articles