0% found this document useful (0 votes)
16 views

Debian Server Configuration Guide

Debian_Server_Configuration_Guide

Uploaded by

Nyan Cat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Debian Server Configuration Guide

Debian_Server_Configuration_Guide

Uploaded by

Nyan Cat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Debian Server Configuration Guide

This guide provides detailed steps to configure various services on a Debian server including SSH,

Apache, WordPress, Postfix, Dovecot, and Roundcube.

Below are the commands and configurations discussed in the conversation.

1. SSH Configuration

1. Install OpenSSH server:

sudo apt-get update

sudo apt-get install openssh-server

2. Check SSH server status:

sudo systemctl status ssh

3. Enable SSH service:

sudo systemctl enable ssh

2. Apache Web Server Configuration

1. Install Apache server:

sudo apt-get install apache2

2. Enable necessary modules:

sudo a2enmod ssl

sudo a2enmod rewrite


3. Create configuration file for www and wordpress subdomains:

sudo nano /etc/apache2/sites-available/000-default.conf

Add the following configuration:

<VirtualHost *:80>

ServerName www.yourdomain.com

DocumentRoot /var/www/html

Redirect permanent / https://www.yourdomain.com/

</VirtualHost>

<VirtualHost *:443>

ServerName www.yourdomain.com

DocumentRoot /var/www/html

SSLEngine on

SSLCertificateFile /etc/ssl/certs/your_cert.crt

SSLCertificateKeyFile /etc/ssl/private/your_key.key

</VirtualHost>

<VirtualHost *:80>

ServerName wordpress.yourdomain.com

DocumentRoot /var/www/wordpress

Redirect permanent / https://wordpress.yourdomain.com/

</VirtualHost>

<VirtualHost *:443>

ServerName wordpress.yourdomain.com
DocumentRoot /var/www/wordpress

SSLEngine on

SSLCertificateFile /etc/ssl/certs/your_cert.crt

SSLCertificateKeyFile /etc/ssl/private/your_key.key

</VirtualHost>

4. Enable new virtual hosts:

sudo a2ensite 000-default.conf

sudo systemctl reload apache2

3. WordPress Installation and Configuration

1. Install necessary packages:

sudo apt-get install php php-mysql mysql-server

2. Create a database for WordPress:

sudo mysql -u root -p

CREATE DATABASE wordpress;

CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';

FLUSH PRIVILEGES;

EXIT;

3. Download and install WordPress:

cd /tmp

wget https://wordpress.org/latest.tar.gz

tar -xvf latest.tar.gz


sudo mv wordpress /var/www/

sudo chown -R www-data:www-data /var/www/wordpress

sudo chmod -R 755 /var/www/wordpress

4. Configure WordPress:

Open your browser and visit https://wordpress.yourdomain.com and follow the installation

instructions.

4. Mail Server Configuration (Postfix and Dovecot)

1. Install Postfix and Dovecot servers:

sudo apt-get install postfix dovecot-core dovecot-imapd

2. Configure Postfix server:

sudo nano /etc/postfix/main.cf

Add or modify the following lines:

myhostname = mail.yourdomain.com

mydestination = yourdomain.com, localhost

smtpd_banner = $myhostname ESMTP $mail_name

biff = no

3. Restart Postfix service:

sudo systemctl restart postfix

4. Configure Dovecot server:


sudo nano /etc/dovecot/dovecot.conf

Add or modify the following lines:

protocols = imap

5. Restart Dovecot service:

sudo systemctl restart dovecot

6. Create two users:

sudo adduser user1

sudo adduser user2

5. Webmail Configuration (Roundcube)

1. Install Roundcube webmail client:

sudo apt-get install roundcube roundcube-core roundcube-mysql

2. Configure Roundcube server:

sudo nano /etc/roundcube/config.inc.php

Set up the appropriate database and server settings.

3. Set up the Roundcube webmail site:

sudo nano /etc/apache2/sites-available/webmail.conf

Add the following configuration:


<VirtualHost *:80>

ServerName webmail.yourdomain.com

DocumentRoot /usr/share/roundcube

Redirect permanent / https://webmail.yourdomain.com/

</VirtualHost>

<VirtualHost *:443>

ServerName webmail.yourdomain.com

DocumentRoot /usr/share/roundcube

SSLEngine on

SSLCertificateFile /etc/ssl/certs/your_cert.crt

SSLCertificateKeyFile /etc/ssl/private/your_key.key

</VirtualHost>

4. Enable the new virtual host:

sudo a2ensite webmail.conf

sudo systemctl reload apache2

You might also like