Step Nine • Antivirus • Apache2 • FTP

19. Virus and spam fighters

  1. Install Amavisd-new, SpamAssassin, ClamAV

20. Apache webserver and modules

  1. Install Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, mcrypt

21. FTP server and quota

  1. Install Pure-FTPd and quota
  2. Tweak Pure-FTPd
  3. Configure quota
19. Virus and spam fighters

19a. Install Amavisd-new, SpamAssassin, ClamAV

Amavisd-new is an interface between mailers on the one hand and virus and spam scanners on the other, where SpamAssassin fights spam and ClamAV fights viruses.

In order to install these programs, select and copy the following code and paste and run it in Terminal:


Antivirus

When asked for confirmation, type: y and ...

Continue

... hit Enter.

20. Apache webserver and modules

20a. Install Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, mcrypt

Next we'll install the Apache2 webserver, server-based script language PHP5, MySQL web-based interface phpMyAdmin, server-based script language FCGI, Apache module suExec allowing script execution with different user-IDs, PHP facilitator Pear, encryption program mcrypt and more Apache modules.

In order to install the server and modules, select and copy the following code and paste and run it in Terminal:


Apache2

When asked for confirmation, type: y and ...

Continue

... hit Enter.

You'll be asked to select your choice:

Select

Hit the space bar to select apache2:

Selected

Then hit your keyboard's Tab key to select <Ok> and ...

OK

... hit Enter.

The system will be busy for a while. When it's ready, some apache modules should be enabled. Select and copy:


Then paste and run the code in Terminal:

Enable

When the system is ready, it'll invite you to restart the apache server on a line stating:

Proposal

Select and copy:


Select and run the code in Terminal:

Restart

You'll get some kind of confirmation afterwards:

Ready

Waiting .. is not really reassuring. Is apache indeed running again? You may ask the system about the server status. Select and run:


Status

Paste and run the code in Terminal. The system should tell you the webserver is running:

Running
21. FTP server and quota

21a. Install Pure-FTPd and quota

Pure-FTPd is a file transfer server. The quota module allows for limiting user space.

Select and copy:


Pure_FTPD and quota

Paste and run the code in Terminal. The system will be busy for a while.

21b. Tweak Pure-FTPd

Running Pure-FTPd from inetd means you will have to startup a new apache process for every connection. We don't want that, so we'll replace inetd by standalone in the proper configuration file.

Users using FPT should be confined to their own site, so they must be chrooted. In the configuration file we'll change false for virtualchroot to true.

Select and copy:


Edit

Paste and run the code in Terminal. Once the configuration file has opened, hit the i key to start editing and move the cursor to inetd on the line starting with STANDALONE_OR_INETD.

Edit file

Replace inetd by standalone:

Standalone

Next, move to false on the line starting with VIRTUALCHROOT:

False

Replace false by true:

True

Save file and quit vi by hitting Esc and typing :wq.

Since we do not want inetd to start Pure-FTPd, we have to edit the inetd.conf file.

Select and copy:


Edit

Paste and run the copied code in Terminal. You'll see:

inetd

Scroll down until you see a line starting with: ftp stream tcp, move the cursor there and hit the i key to start editing:

Move to line

Comment out this line by typing a hash #:

Hash

Save file and quit vi by hitting Esc and typing :wq.

Now restart inetd.

Select and copy:


Restart

Paste and run the code in Terminal. You'll get this result:

Restart

As you can see, inetd will not start the FTP server. That's what we wanted.

We'll do what inetd doesn't: start Pure-FTPd.

Select and copy:


Start

Paste and run the code in Terminal. Confirmation that the FTP server is running looks like this:

Running

PureFTPd doesn't show hidden files such as .htaccess yet. Since we want to be able to see those files on the server, select and copy:


Show dotfiles

Paste and run the code in Terminal.

Next, restart Pure-FTPd. In order to do so, select and copy:


Restart

Paste and run the code in Terminal. Now Pure-FTPd will show hidden dotfiles such as .htaccess.

21c. Configure quota

Quota are to be configured in the file fstab.

Select and copy:


Edit

Paste and run the code in Terminal.

In the open fstab file, locate the line with <mount point> / for root. Below, it's the 5th line.

fstab

Following the code fragment errors=remont-ro add: ,usrquota,grpquota

Add

Save file and quit vi by hitting Esc and type :wq.

Now enable quota.

Select, copy, then paste and run these lines one after the other in Terminal:




On the screen, nothing seems to be happening, but don't worry.

Now select and copy:


Quotacheck

Paste and run the code in Terminal.

The system will be busy for a while and then show some results:

Result

Now we're going to turn quota on. Select and copy:


Quota on

You'll get this confirmation:

Results

On to the next page.

Drag this box to where you want it
vi | shell
command action command action
su become superuser rm foo delete file foo
ls show files & directories rmdir foo delete directory foo
ls -a show invisible items too rm -rf foo delete dir foo + content
ls -l show long names chmod change permissions
ls -la show long and invisible chmod 755 foo set 755 for foo
cd change directories vi /etc/foo open file foo in vi
cd / go to root directory apt-get install get and install application
cd /etc go to etc via root tar -xzvf extract zip file
cd /tmp go to temp via root exit finish Terminal session
/etc/init.d/restart apache2 restart the Apache server
/etc/init.d/status apache2 show if the Apache server is running
shutdown -h now shutdown the system immediately
shutdown -r shutdown and reboot the system
vi | shell
<= keyboard hits => action
  i   insert (start editing)
  arrows   move around
  backspace   delete to the left
  delete   delete to the right
  esc   stop editing
esc :w enter stop editing, save changes and keep vi open
esc :wq enter stop editing, save changes and exit vi
esc :q enter stop editing, exit vi without saving

Assistance

vi & shell

Contact