Posts Tagged Debian

Create virtual host on a Debian Stretch server

After a Debian 9 server (Debian GNU/Linux 9 (stretch)) was installed, a web server with virtual host capability was needed.  At the first step, creating a conf file for the virtual host and enabling it and  then restarting the apache2 service were successful. However, the next step was not straightforward.  After files were copied to the root folder of the virtual host, error messages were persistent whenever which pages were visited.

The error message like” You don’t have permission to access <page name> on this server”. It was wired because the same virtual host conf file was fine on Ubuntu servers with old Linux version.

After googling the internet, the problem was nailed down. the new version of Apache2 increases the security of virtual hosts. One more directive is needed to make it work. In the virtual host conf file, need add “Require all granted”. A working version of an virtual host conf file is the following.

<VirtualHost *:80>

# Indexs + Directory Root.
DirectoryIndex index.html index.php
DocumentRoot {your virtual host root data folder}

<Directory />
  Options FollowSymLinks
  AllowOverride None

<Directory "{your virtual host root data folder}">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  # new directive needed in Apache 2.4.3 and beyond
  Require all granted

# Logfiles
ErrorLog {your virtual host root folder}/logs/error.log
CustomLog {your virtual host root folder}/logs/access.log combined


Tags: , , , ,

Ping external domain failed on Debian Stretch

After a debian stretch server was setup, pinging external domain always failed. That makes installing any packages / software impossible because it cannot access the server.

After a lengthy searching on Google, finally the problem was nailed down and solved easily. The cause of the problem is the Debian Network Manager. To solve this problem, please execute the following command line commands in a terminal.

apt-get remove --purge network-manager
nano /etc/resolv.conf

Add the following line to the resolv.conf file.


You should change the IP address based on your wireless network accordingly.

After the change, reboot your computer to a fresh start. Then execute the following commands.

apt-get update
apt-get install <your package name>


Tags: , ,

Use rcconf to enable and disable Debian/Ubuntu services

The system security of Debian / Ubuntu Linux box depends upon system services. If you need to provide a web server (Apache service) to serve web pages, you have to install and enable apache service. In another hand, if you do not need a service, you should always turn it off all. The reasons are too fold: 1) reduce security risk and 2) release system resource.

Long time ago, I switch off some services in my Ubuntu server. I wanted to enable some of them now. I forgot what command I used to do that. I searched the Internet and found several commands, such as update-rc.d and rcconf. update-rc.d can be used directly. rcconf package need to be installed before use. rcconf is a Debian Runlevel configuration tool. It configures system services in connection with system runlevels. It switches on/off services. It is a frontend to the update-rc.d command.

You need install the rcconf package first.

apt-get install rcconf

Once the rcconf package is installed, you can start the application by typing rcconf directly. The application brings up a nice test user interface, you can use arrow buttons and space button in your keyboard to switch on and off any services. After you finish, just move to and press Enter. You are done. Next time your system reboots, you will have new configuration take effects. The following screen shot is the user interface of rcconf.


Tags: , , , , , , ,

Use munin to monitor Ubuntu server performance

munin is a light weight server monitoring tool. After I read the following two articles I decided to give a try. Here are the links for the articles:
Monitor Servers and Clients using Munin in Ubuntu
Monitoring systems with munin

The setup is a piece of cake. I have a little bit confusion when I setup allow IP at munin-node cconfig file. But I figured out after reading the articles. The IP should be the munin server’s IP address. It means that allow munin server at that IP to survey the munin client.

Another place I was confused was to start munin server. I checked /etc/crontab and did not see anything related to munin. I manually added an entry based an article describing how to use munin in red-hat system. It was not right on Debian/Ubuntu. I learned that there is cron job was put in /etc/cron.d for munin. Yes, indeed there is one. I waited a while and did not see any update on the web page. I decided to manually execute the munin once. I used the following command:

/usr/bin/munin-cron –force-root

If you change the htmldir, please remember to change the owner and group of the new directory and its subdir to munin:munin. Otherwise you will get some error message like “Lock already exists: /var/run/munin/munin-graph.lock. Dying.”. The command is:

chown -R munin:munin

Read details about AWFFULL http log analysis tool at Use AWFFULL to analyze website log files.


Tags: , , , , , ,

File server and automatic backup


有效的解决办法是在家里设置文件服务器,直接连接到内部网络上。我在学习使用LinkSys生产的NSLU2时,通过将该设备的系统固件更换为Debian Linux(具体方法见Debian on NSLU2),使其功能极大地增强。鉴于本文讨论文件自动备份,下面就如何设置文件服务器和备份软件进行阐述。

硬件准备:你需要购置两台Linksys NSLU2和两个USB外置硬盘,硬盘最好是2.5英寸的,不需要额外的电源适配器,同时可以节约能源。硬件购回后,需要按照Debian on NSLU2一文的步骤对硬盘格式化和对NSLU2安装新的固件。完成这一步骤后,下面就只剩软件的安装了。

SAMBA文件服务器:绝大多数计算机用户使用Windows,所以必须使Windows计算机可以访问文件服务器。Debian Linux系统的SAMBA服务器提供了这样的功能。首先在linux系统中安装SAMBA服务器软件,然后参考Build a full-blown file/web server on Linksys NSLU2这篇文章的有关章节对SAMBA服务器进行配置,主要是设置共享目录。你只需要在一台NSLU2机器安装该软件。

        path = /samba
        public = yes
        read only = no
        create mask = 0777
        directory mask = 0777
        writable = yes
        browsable = yes
        guest ok = yes



在使用NFS服务器的机器上,你需要修改/etc/fstab,使系统自动配置NFS服务器文件系统。    /mnt/pstorage    nfs     rw,rsize=65536,wsize=65536,hard,intr,async,nodev,nosuid   0       0


55 5     * * *   root    rsync -a --delete /var/vmail/  /mnt/pstorage/mails



Tags: , , , , , , , , ,