Setting up Debian from scratch for Apache + PHP + MySQL

Setting up Debian linux from scratch for Apache + PHP + MySQl, so you order a server with administration and nothing is set. On the ring is important, if you don’t need any extra demons you can verify and add exactly what you need.
first of all update packages
apt-get update
apt-get upgrade
When we need an editor, I prefer mc me as far from human linuxa more convenient to work in normal heights — Editor, he recalled the good old Norton, also there are alternative mc this deco it much easier in memory.
apt-get install mc
MC
Options menuConfiguration issue > tick use the Internal Editor
We need SSL, most likely you‘ve put Admins if you are in the console but still if this is your home server then you need to make
apt-get install ssh opensshserver
set the hostname:
mcedit/etc/hosts
and here
/etc/hostname
for the changes to take effect:
hostname.sh/etc/init.d/
to linux automatically synchronized time:
apt-get install ntp ntpdate
then practically can forget about installing manually, all will be placed itself🙂
Perhaps you want more security, put the package sudo
apt-get install sudo
before any operation as root you can take complete only through su
or like this:
sudo su
Now your console under admin. For what it’s done, let’s say you went left open shell, any prisevšij for the computer will not be able to do anything without the password🙂 I personally put the package in insklûčitel′nyh cases for the server think it is a little too, because it is very difficult to leave the console, the console can be accessed only through PITI and only knowing the password, if the password znaeš and meaning in sudo? and if zloumyšlinik got on the server through the hole in php it doesn’t work sudo. Vobschem some besmysleno for udalenogo Server IHMO. If you express a different opinion.
Install MySql
apt-get install mysql-client mysql-server
If you are not asked what kind of password do so:
mysqladmin-u root password newpass
either way:
MySQLuroot
MySQL use mysql >;
MySQL > UPDATE user SET Password = PASSWORD ( newpass ) WHERE User = ‘ root ‘;
MySQL > FLUSH PRIVILEGES;
Update: 2012.05.04 solve problems with root MySql MySql root user details here
do I need phpmyadmin? of course you need, but to put it from the distribution much wildness or should be copied into any available for you and because the uninstall. What is the reason, why do you need phpmyadmin is the default, because everybody knows how to find it. And you can ramestit′ any folder of the representatives on any website prevâzanom to your server, thus increase the let not much but yet your peaceful life.
apt-get install phpmyadmin
copy any you welcome, followed by:
apt-get autoremove phpmyadmin
personally, I‘m downloading it off the developer’s site. for example here is the php-myadmin.ru after the move it to the server. I usually mean it too 7z put on the server.
apt-get install p7zip
usually depending on the distro 7z can be obozvan and 7zr and 7za, to make it all as usual
ln-s/usr/bin/7zr/usr/bin/7z
and you can always call your 7z is much easier and faster than tar bz2 or gz + while a matter of habit. But the move quickly for 7z stretch between sites of close better. Some of the few powerful servers 7z can not start, consider this.
Forgot to mention, it’s MySQL password do the most important problem of all security, because that is always open to … This does not have to do it over a powerful, provided that it will be used only for localhost. Any entries on the site through the hole, could simply watch it🙂 in the config Did you remember the headache. So for sites do a user with minimal privileges. required site! never propisyvajte in the konfigah password root. The most dangerous privileges this FILE OUT and FILE in. forewarned the safe.
It is time to install Apache + PHP
apt-get install apache2 apache 2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap php5-cli php5-cgi, libapache2-mod-on the fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp ruby libapache2-mod-php5-curl
I installed modules which are considered necessary, any module which we consider more than just ubirite from a string. This can be done individually.
switch modules
suexec a2enmod rewrite ssl actions include
a2enmod dav_fs dav auth_digest
and restart Apache
/etc/init.d/apache2 restart
If you see any errors you decide them. A common error is to
Restarting web server: apache2apache2: Could not reliably determine the fully qualified domain name server’s, using * * * * * * .com for ServerName
… of waiting. apache2: Could not reliably determine the fully qualified domain name server’s, using * * * * * * .com for ServerName
This is due to the fact that this site is not linked to the server which in itself is of course you still only have solved the problem:
in/etc/apache2/apache2.conf file
mcedit/etc/apache2/apache2.conf
Add the line:
Servername * * * * * *
From this moment the server is ready to be placed on the sites. FTP I do not put because there is a wonderful program. winscp.net, she is able to SSH protocol to do all operations with files on the server at times more convenient FTP.
odd is nginx and bind9, but that’s another story.

Leave a Reply

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