Results 1 to 2 of 2

Thread: How to Set up a web server on Debian Etch

  1. #1
    Join Date
    May 2008
    Posts
    420

    How to Set up a web server on Debian Etch

    Install a web server via SSH2 (Debian Etch 4.0)

    So people today will learn to install a web server on Debian Etch 4.0.

    Everything you need for this are:
    - Putty (downloadable here: http://the.earth.li/~sgtatham/putty/.../x86/putty.exe)
    - The program 'nano' on the Web. Installation instructions for nano see Annex.
    - Set 3 with Filezilla SFTP (name: root, PW: root, host: Server IP, Port: 22, Method: SFTP over SSH2) for download

    Download Filezilla Here: https://www.ohloh.net/projects/filez...ux-gnu.tar.bz2

    (1) install and configure Apache2

    The first time it will be times that we have the Apache web server on download and then install it. This is on Debian

    simple, to last us the following command:

    Code:
    apt-get install apache2
    Since it waits until it is finished, and Apache is already installed. If you now your IP / domain at which the vServer call / Root server is running, it must an HTML page with "It Works!"

    see. If yes, go on!

    First, let's see this with "It Works!" delete.

    This report we Filezilla 3 normal and go into the folder/var/www (in the main folder, it is necessary on top of .. / to press to the folder / root to leave) and delete because the folder / apache2-default. This would be the folder disappears, but the redirect is still there? To do this we must know that the so-called Apache Virtual hosts (called VHOST) port, which serve different domains on forward several folders.

    However, there is always a VHOST, currently on the directory/var/www shows and everybody calling, although it IP or domain is displayed.

    We now open the configuration file of the VHOST give command:

    Code:
     nano/etc/apache2/sites-enabled/000-default

    Now we are looking for simply the line:

    Code:
     RedirectMatch ^ / $ / apache2-default /


    The replacement we are now with

    Code:
    # RedirectMatch ^/$/apache2-default/

    and press CTRL + O (simultaneously) so that the changes in nano stores. nano might even ask whether or not to be saved, then confirmed with Yes.

    Now a small snag: Not as usual, Windows are changes immediately, but after a restart

    (Restart) the Apache servers. This can be done as follows:

    Code:
    /etc/init.d/apache2 restart
    This would be the transmission off and you have just installed Apache!


    (2) install PHP5

    Now we have Apache, well and good .. But what's with PHP for PHP enabled dynamic pages?

    Very easy. Since we now Apache is installed and configured, the following command is sufficient:

    Code:
    apt-get install php5
    and then restart Apache. You know no more about how to go? As above wars ever then just again:

    Code:
    /etc/init.d/apache2 restart

    The best advise I have the php5-GDlib to install, that can be used for certain applications, such as WBB3 or Joomla!.

    Code:
    apt-get install php5-gd
    And done!


    (3) MySQL Server

    What is now using PHP5, but if we do not MYSQL for a forum or have a CMS? Do not worry ... MySQL is just as easy. Even with - Who would have guessed - a command:

    Code:
    apt-get install mysql-server
    If, however, we now try to work with PHP is a mysql connection set up will not work because PHP MySQL extension is needed.

    This is installed as follows:

    Code:
    apt-get install php5-mysql
    Simply restart Apache, if not identical functions. What, you've already forgotten how to do this?

    Code:
    /etc/init.d/apache2 restart

    (4) Final

    Now we have everything a webserver needed - really.

    Very useful is also phpmyadmin, we also - as usual - with a command to install:

    apt-get install phpmyadmin

    Now after running just call phpmyadmin.

    This is easy:

    Calling phpmyadmin -> in the main window at the bottom of "rights" click -> behind "root" - "localhost" on the Edit icon

    Click. Here then for the "Change Password" seek new password and then click the OK buttons on the right

    click - ready!

    This must be done when you might use "root" - "your-host" or "root" - "your IP" repeat.

    And so we have a functioning au phpmyadmin! MYSQL and secured!

    them upload file via SFTP.

    (5) Annex

    So goes the well again with apt-get, namely this:

    Code:
    apt-get install nano
    and then the isch also ready.


    (6) Install Sendmail

    How sure many have noticed, this configuration is the PHP function mail () not. (Mail sent via PHP) This can be achieved simply by adding the following code is executed:

    Code:
    apt-get install postfix
    The Postfix installation must "Internet Server" as the purpose may be indicated. How it works Sendmail immediately!


    (7) Install ProFTPd with MySQL support (via FTP user MySQL)

    we have again with apt-get install command to start.

    This time with

    Code:
    apt-get install proftpd-mysql
    When installing the possibly occurring window with OK.


    To FTP user MySQL by adding to, we need a connection ProFTPd <-> MySQL and of course an all-round user with all the users on the server.

    This FTP user later include all folders / files in the FTP area, so you do not have specific rights for each individual user needs.

    So we will focus then was the first time with a userID is not in the system is busy. I did this just randomly put the ID 2593. Previously, however, we must create a group in which we the users "park". Here I take my ID 2593rd

    So are the 2 commands:

    Code:
    groupadd-g 2593 ftpgroup

    Code:
    useradd-u 2593-s/bin/false-d/bin/null-g ftpusers ftpgroup


    Hereby, we have now our ftpusers.

    This also can access to everything we have to complete the FTP directory to the user to assign. This goes with the command

    Code:
    chown-hrv ftpusers: ftpgroup/foldername/foldername


    When we FTP user for a web directory in the Apache / var / www want, then go with the

    Code:
    chown-hrv ftpusers: ftpgroup/var/www


    Now that is just the connection ProFTPd <-> MySQL. And this is now a bit more effort.

    The first thing we need in a user for MYSQL ProFTPd create. This is special to phpmyadmin: One click, and announced the following SQL command:
    Code:
    	MySQL Query (s)

    CREATE DATABASE ftp; GRANT SELECT, INSERT, UPDATE, DELETE ON ftp. * TO 'proftpd' @ 'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;

    Please also replace the password!

    Next, we then (again in phpmyadmin choose from on DB -> FTP -> SQL) at the tables.

    Code:
     CREATE TABLE ftpgroup ( 
      groupname varchar (16) NOT NULL default'', 
      gid smallint (6) NOT NULL default'2593 ', 
      members varchar (16) NOT NULL default'', 
      KEY groupname (groupname) 
      ) TYPE = MyISAM COMMENT = 'ProFTP group table'; ftpquotalimits CREATE TABLE ( 
      name varchar (30) default NULL, 
      quota_type enum ( 'user', 'group', 'class',' all ') NOT NULL default' user ', 
      per_session enum ( 'false', 'true') NOT NULL default 'false', 
      limit_type enum ( 'soft', 'hard') NOT NULL default 'soft', 
      bytes_in_avail int (10) unsigned NOT NULL default'0 ', 
      bytes_out_avail int (10) unsigned NOT NULL default'0 ', 
      bytes_xfer_avail int (10) unsigned NOT NULL default'0 ', 
      files_in_avail int (10) unsigned NOT NULL default'0 ', 
      files_out_avail int (10) unsigned NOT NULL default'0 ', 
      files_xfer_avail int (10) unsigned NOT NULL default'0 ' 
      ) TYPE = MyISAM; ftpquotatallies CREATE TABLE ( 
      name varchar (30) NOT NULL default'', 
      quota_type enum ( 'user', 'group', 'class',' all ') NOT NULL default' user ', 
      bytes_in_used int (10) unsigned NOT NULL default'0 ', 
      bytes_out_used int (10) unsigned NOT NULL default'0 ', 
      bytes_xfer_used int (10) unsigned NOT NULL default'0 ', 
      files_in_used int (10) unsigned NOT NULL default'0 ', 
      files_out_used int (10) unsigned NOT NULL default'0 ', 
      files_xfer_used int (10) unsigned NOT NULL default'0 ' 
      ) TYPE = MyISAM; CREATE TABLE ftpusers ( 
      id int (10) unsigned NOT NULL auto_increment, 
      userid varchar (32) NOT NULL default'', 
      passwd varchar (32) NOT NULL default'', 
      uid smallint (6) NOT NULL default'2593 ', 
      gid smallint (6) NOT NULL default'2593 ', 
      homedir varchar (255) NOT NULL default'', 
      shell varchar (16) NOT NULL default '/ sbin / nologin', 
      int count (11) NOT NULL default'0 ', 
      accessed datetime NOT NULL default'0000-00-00 00:00:00 ', 
      modified datetime NOT NULL default'0000-00-00 00:00:00 ', 
      PRIMARY KEY (id), 
      UNIQUE KEY userid (userid) 
      ) TYPE = MyISAM COMMENT = 'ProFTP user table';
    Here we are then in MYSQL field ready, and can shut phpmyadmin. PUH! Just a sip from our coffee pot (see the equipment you need at the top )

    Now, only how to connect to the MySQL proftpd.conf (/ etc/proftpd/ proftpd.conf) to be taught !

    First of all we must ProFTPd say that we are MySQL and PostgreSQL do not use.

    Open the modules.conf as follows:

    Code:
    nano/etc/proftpd/modules.conf


    Here we look for the following location:

    Code:
    LoadModule mod_sql_postgres.c
    and save it with CTRL + O to file.

    Next, we take the proftpd.conf with the command

    Code:
    nano/etc/proftpd/proftpd.conf

    Here we add the following things at the very end of the file:

    THERE MUST ENSURE THAT THE PASSWORD ("SQLConnectInfo ftp @ localhost proftpd password" PASSWORD CHANGED INTO THAT IS FOR THE USER IN MYSQL FTP has created!

    Code:
    DefaultRoot ~ # The passwords in MySQL are encrypted using CRYPT SQLAuthTypes Plaintext Crypt SQLAuthenticate users * groups * # used to connect to the database # databasename @ host database_user user_password SQLConnectInfo ftp @ localhost proftpd password # Here we tell ProFTPd the names of columns in the database The "user table" # we want it to interact with.  Match the names with those in the db SQLUserInfo ftpusers userid passwd uid gid homedir shell # Here we tell ProFTPd the names of the database columns in the "group table" # we want it to interact with.  Again the names match with those in the db SQLGroupInfo ftpgroup groupname gid members # set min UID and GID - otherwise these are 999 each SQLMinID 500 # create a user's home directory on demand if it does not exist on SQLHomedirOnDemand # Update count every time user logs in SQLLog PASS update update count count SQLNamedQuery UPDATE "count = count +1, accessed = now () WHERE userid = '% u'" ftpusers # Update modified everytime user uploads or deletes a file SQLLog STOR, DELE modified SQLNamedQuery modified UPDATE "modified = now () WHERE userid = '% u' "ftpusers # User quotas # =========== QuotaEngine on QuotaDirectoryTally on QuotaDisplayUnits Mb QuotaShowQuotas on SQLNamedQuery get-quota-limit SELECT" name, quota_type, per_session, limit_type , bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '% (0)' AND quota_type = '% (1)' "SQLNamedQuery get-quota-tally SELECT" name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used , files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '% (0)' AND quota_type = '% (1)' "SQLNamedQuery update-quota-tally UPDATE" bytes_in_used = bytes_in_used +% (0), bytes_out_used =% (+ bytes_out_used 1), bytes_xfer_used = bytes_xfer_used +% (2), files_in_used = files_in_used +% (3), files_out_used = files_out_used +% (4), files_xfer_used = files_xfer_used +% (5) WHERE name = '% (6)' AND quota_type = '% (7)' "ftpquotatallies SQLNamedQuery insert-quota-tally INSERT"% (0),% (1),% (2),% (3),% (4),% (5),% (6) ,% (7) "ftpquotatallies QuotaLimitTable sql: / get-quota-limit QuotaTallyTable sql: / get-quota-tally/update-quota-tally/insert-quota-tally SQLNamedQuery gettally SELECT" ROUND ((bytes_in_used/1048576), 2 ) ftpquotatallies FROM WHERE name = '% u' "SQLNamedQuery getlimit SELECT" ROUND ((bytes_in_avail/1048576), 2) FROM ftpquotalimits WHERE name = '% u' "SQLNamedQuery getfree SELECT" ROUND (((ftpquotalimits.bytes_in_avail-ftpquotatallies.bytes_in_used ) / 1048576), 2) FROM ftpquotalimits, ftpquotatallies WHERE ftpquotalimits.name = '% u' AND ftpquotatallies.name = '% u' "SQLShowInfo LIST" 226 "" Used% (gettally) MB from% () getlimit MB. You Have getfree% () MB available space. "RootLogin RequireValidShell off off
    This goes also with the proftpd.conf.

    Then we open again phpmyadmin and enter our FTP group. (DB select -> ftp -> SQL)

    Code:
    INSERT INTO `ftpgroup` ( `groupname`, `gid`, `members`) VALUES ( 'ftpgroup', 2593, 'ftpusers');


    Now we can add users.

    This is quite simply with the command (DB Select -> ftp -> SQL):

    Code:
    INSERT INTO `ftpusers` ( `id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES (1, 'USERNAME', 'PASSWORD', 2593, 2593, '/ DIRECTORY / LIST', '/ sbin / nologin', 0,'','');


    Please specify that the top eighth data required to be replaced.

    After the whole procedure to restart the server with ProFTPd

    Code:
    /etc/init.d/proftpd restart
    And then we are finished with our FTP users to process .. this art can easily add new ones! It should only be observed that the shell (/sbin/nologin) and the gid/uid are not modified.

    Also should be noted that the user on the list that we have rights to assign them - in case of doubt, therefore run the below command :

    Code:
    chown-hrv ftpusers:ftpgroup/directory/directory

  2. #2
    Join Date
    May 2008
    Posts
    297

    Re: How to Set up a web server on Debian Etch

    I wanted to my root up a web server and since I've seen your tutorial and I just made as you've explained it here but somehow I can now no longer log in with SSH since then always the username is wrong.

Similar Threads

  1. How to Install SSH server and use it on Debian
    By blueprats in forum Guides & Tutorials
    Replies: 3
    Last Post: 15-06-2010, 09:47 AM
  2. Backup server under Debian
    By Lauren Ambrose in forum Operating Systems
    Replies: 5
    Last Post: 29-03-2010, 11:01 AM
  3. Migrate Debian Etch Server Hardware
    By Xmen in forum Operating Systems
    Replies: 5
    Last Post: 17-12-2009, 12:40 PM
  4. DRBD 8.3 Third Node Replication With Debian Etch
    By Bankebihari in forum Operating Systems
    Replies: 4
    Last Post: 28-04-2009, 01:11 PM
  5. Installing Debian Etch on Macbook
    By Samra in forum Operating Systems
    Replies: 2
    Last Post: 30-01-2009, 08:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,058,318.31525 seconds with 17 queries