วันพุธที่ 13 พฤษภาคม พ.ศ. 2558

Install webmin on debian 8

Install webmin on debian 8
If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system
#vi /etc/apt/sources.list
Add the following lines
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
Save and exit the file
You should also fetch and install my GPG key with which the repository is signed, with the commands
#cd /root
#wget http://www.webmin.com/jcameron-key.asc
#apt-key add jcameron-key.asc
Update the source list using the following command

#apt-get update
#apt-get install webmin

How to install Drupal on Debian 8

Adapted From http://www.davidam.com/docu/installingdrupal.html

Installing Drupal in Debian/Ubuntu GNU/Linux
Table of Contents
1 Installing Debian Packages

A fast way to do it with mysql may be the next:

$ sudo apt-get install  drush

Drush is an useful tool to facilitate the manage of our drupal by command line, by example, updates of modules, backups, etc.

Really, it's better download the last version of drupal that the debian package, due to my policy of use drush to upgrades. But install drupal7 as debian package is a good idea to install depedencies.

$ cd /var/www/
$ sudo drush dl drupal
$ sudo chown -R www-data.www-data drupal-7.3x
$ sudo chmod g+w -R drupal-7.3x
$ sudo mv drupal-7.32 mysite

2 Configuring Apache

To install a drupal site, I would like enable clean urls, to it I will create the file mysite in /etc/apache2/sites-available/mysite.conf, with the next content:




 
NameVirtualHost 192.168.1.29:80


  ServerAdmin webmaster@localhost
  ServerName mysite

  DocumentRoot /var/www/mysite

 
                RewriteEngine on
                RewriteBase /mysite
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
 

 
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
       





Due to in this moment don't have the domain of the site it will be possible enable the host in /etc/hosts

127.0.0.1       localhost
127.0.1.1       mysite

Later, we can enable it so:

$ sudo a2enmod rewrite
$ sudo a2ensite mysite

3 Creation of the database in Mysql

$ mysql -u root -p
mysql> create database drupal7;
mysql> create user 'drupal7'@'localhost' identified by 'lapasswd';
mysql> grant all privileges on drupal7.* to 'drupal7'@'%' with grant option;

4 Creation of the database in Postgresql

First of all, you must install the needed debian packages:

$ sudo apt-get install postgresql-9.1 postgresql-client php5-pgsql

Now, you can create the database and the user to postgres.

$ createuser dpsql --pwprompt --encrypted
$ createdb dpsql --owner=dpsql

To use the psql client on local you can modify the line local in /etc/postgresql/9.1/main/pghba.conf:

local             all            all                   trust

If you want change the pass you can do:

$ psql -U dpsql dpsql -W
dpsql=> ALTER USER dpsql with password 'thepassword';

5 Web install

First, you can remove permissions to CHANGELOG.txt to avoid security problems:

$ cd /var/www/mysite/
$ chmod 600 CHANGELOG.txt

So enabled the site, you can go to http://mysite/install.php and the installation is done step by step

In the step 4 (Set up database) you can find database name, database username and database password with the data provided.
6 Simple backup system

You can do a tar file every day at 13:00 with:

$ crontab -e

And introducing a line such as

0 13 * * * /bin/tar -cvzf /var/backups/drupal7-$(date "+%d-%m-%Y").tar.gz /var/www/drupal7
0 13 * * * cd /var/www/drupal7; drush sql-dump > /var/backups/drupal7-$(date "+%d-%m-%Y").sql

You must check if the cron user has permissions to make the backup, sure. Perhaps, you need create a sh script, if you have troubles.
7 Ssl

The first steps is enable ssl in apache and create the ssl certificates.

$ sudo a2enmod ssl
$ sudo service apache2 restart
$ sudo mkdir /etc/apache2/ssl
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Later, we can create virtualhost mysite-ssl



  ServerAdmin webmaster@localhost
  ServerName mysite:443

  DocumentRoot /var/www/mysite

 
                RewriteEngine on
                RewriteBase /mysite
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
 

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key



We can enable the virtualhost

$ sudo a2ensite default
$ sudo service apache2 reload

And enable securelogin

$ cd /var/www/mysite/
$ drush dl securelogin
$ drush en securelogin

Finally, I use go to the configuration to request https in forms.
8 Nagios

$ sudo apt-get install nagios3
$ sudo htpasswd -c htpasswd.users nagiosadmin

Go to http://localhost/nagios3/
9 References

    https://drupal.org/documentation/install


วันพฤหัสบดีที่ 7 พฤษภาคม พ.ศ. 2558

Automouont usb on debian

sudo apt-get install usbmount  
usbmount will automount hfsplus, vfat, and ext (2, 3, and 4) file systems. You can configure it to mount more/different file systems in /etc/usbmount/usbmount.conf. By default it mounts these file systems with the sync,noexec,nodev,noatime,nodiratime options, however this can also be changed in the aforementioned configuration file.
usbmount also supports custom mount options for different file system types and custom mountpoints.

Cited from http://unix.stackexchange.com/questions/134797/how-to-automatically-mount-an-usb-device-on-plugin-time-on-an-already-running-sy

Install Fonts on debian 8

Installing fonts on Debian, Ubuntu or other Debian based systems is an easy task.
This is what you have to do when you download the font from a specialized site (e.g. dafont.com) and want to use it on your Linux and Unix System.
The fonts can be copied in one of this directories:
  • /usr/share/fonts
  • /usr/share/X11/fonts
  • /usr/local/share/fonts
  • ~/.fonts
I recommend you to put the fonts in /usr/share/fonts if you need everybody  to use them, and in the user’s $HOME/.fonts if they are for a certain user.
$ cp /path/to/font.ttf ~/.fonts
After you copy the fonts in one of the font directories, do this:
$ fc-cache -fv
The fc-cache command reads and caches all the fonts installed in the font directories.

Cited from
http://linuxg.net/short-guide-install-fonts-on-debian-and-ubuntu/

วันจันทร์ที่ 4 พฤษภาคม พ.ศ. 2558

Input thai in lubuntu

sudo apt-get install ibus-table-thai

Clonezilla USB setup with GNU/Linux

How to setup Clonezilla boot drive USB setup with GNU/Linux

1. First you need to download or install the tuxboot file on your system. Please follow the download page to download or install the file on your GNU/Linux system.
(http://clonezilla.org/liveusb.php)

2. Download Tuxboot from http://sourceforge.net/projects/tuxboot/files/
(using deaian1_amd64.deb)
http://sourceforge.net/projects/tuxboot/files/0.8/Linux/debian-amd64/tuxboot_0.8debian1_amd64.deb/download
(Ref :http://tuxboot.org/download/)

3. Install tuxboot on ubuntu then 
4. Mount thumb drive on ubuntu machine
The first time I had this kind of problem was when I was trying to create a bootable USB drive and a pop-up windows appeared informing me that “you must first mount USB drive /dev/sdc1 to a mount-point. Most distributions will do this automatically after you remove and reinsert the USB drive”. I had never had this matter on Linux because, normally, all the USB drives are immediately recognized and mounted but there is always a first time….
After some googling I discovered that a specific program dconf-editor could help me to check the Linux settings and to consequentlyresolve the situation.
First of all you need to install dconf-editor on your Linux so you have to open a Terminal and type:
sudo apt-get install dconf-tools
After the installation you launch dconf-editor (for MATE environment it’s into the System Tool menu) and navigate it to media-handling:
org –> gnome –> desktop –> media-handling
Now you have to be sure that commands automount and automount-open are both flagged.
If you discover that they are already flagged, its necessary to manually create a mount point using the Terminal.
Open a Terminal and type:
df -H
to see the mounted disks. If you are not able to find the USB drive that you want to mount then type:
sudo fdisk -l
and you’ll see all disks (mounted/unmounted).
Now you are able to know the right drive identity (e.g. sdb1, sdc1, sdd1) that your OS assigned to that specific drive. Memorize it and start to create the mount point:
sudo mkdir /media/newusb
where “newusb” is the mount point name you want to assign to your USB drive.
Then type:
sudo mount /dev/sdb1 /media/newusb
where “sdb1″ is the drive identity we found before and “newusb” the mount-point name you choose.
That’s it, now your USB drive has a mounting point and you can use it (in my case I was able to create a bootable USB drive usiing Unetbootin)
4. Run tuxboot by
sudo tuxboot


วันพฤหัสบดีที่ 24 กรกฎาคม พ.ศ. 2557

Vitamin E

Nutritional Medicine for cirrhosis

Increase antioxidant intake, to reduce damage to liver cells from free radicals.
The most important antioxidants include –
  • Natural 1000 IU daily (some people may need 2000 IU)
  • 1000 mg twice daily
  • 200 – 300 mcg daily
  • To convert from mg to IU: 1 mg of alpha-tocopherol is equivalent to 1.49 IU of the natural form or 2.22 IU of the synthetic form.
  • To convert from IU to mg: 1 IU of alpha-tocopherol is equivalent to 0.67 mg of the natural form or 0.45 mg of the synthetic form.

  • Table 1: Recommended Dietary Allowances (RDAs) for Vitamin E (Alpha-Tocopherol) [6]
    AgeMalesFemalesPregnancyLactation
    0–6 months*4 mg
    (6 IU)
    4 mg
    (6 IU)
    7–12 months*5 mg
    (7.5 IU)
    5 mg
    (7.5 IU)
    1–3 years6 mg
    (9 IU)
    6 mg
    (9 IU)
    4–8 years7 mg
    (10.4 IU)
    7 mg
    (10.4 IU)
    9–13 years11 mg
    (16.4 IU)
    11 mg
    (16.4 IU)
    14+ years15 mg
    (22.4 IU)
    15 mg
    (22.4 IU)
    15 mg
    (22.4 IU)
    19 mg
    (28.4 IU)
    *Adequate Intake (AI)
  • Sources of Vitamin E

    Food
    Numerous foods provide vitamin E. Nuts, seeds, and vegetable oils are among the best sources of alpha-tocopherol, and significant amounts are available in green leafy vegetables and fortified cereals (see Table 2 for a more detailed list) [7]. Most vitamin E in American diets is in the form of gamma-tocopherol from soybean, canola, corn, and other vegetable oils and food products [4].
    Table 2: Selected Food Sources of Vitamin E (Alpha-Tocopherol) [7]
    FoodMilligrams (mg)
    per serving
    Percent DV*
    Wheat germ oil, 1 tablespoon20.3100
    Sunflower seeds, dry roasted, 1 ounce7.437
    Almonds, dry roasted, 1 ounce6.834
    Sunflower oil, 1 tablespoon5.628
    Safflower oil, 1 tablespoon4.625
    Hazelnuts, dry roasted, 1 ounce4.322
    Peanut butter, 2 tablespoons2.915
    Peanuts, dry roasted, 1 ounce2.211
    Corn oil, 1 tablespoon1.910
    Spinach, boiled, ½ cup1.910
    Broccoli, chopped, boiled, ½ cup1.26
    Soybean oil, 1 tablespoon1.16
    Kiwifruit, 1 medium1.16
    Mango, sliced, ½ cup0.74
    Tomato, raw, 1 medium0.74
    Spinach, raw, 1 cup0.63
Vitamin E is able to reduce the ability of the stellate cells to manufacture collagen and so reduces scar tissue production. Vitamin E can also soften existing scar tissue and therefore improve blood flow to the liver, which is essential for regeneration of the liver cells. Vitamin E assists in the maintenance of high levels of glutathione, which is the most powerful liver antioxidant to prevent cirrhosis. A clinical study of hepatitis C sufferers not responding to interferon therapy, showed that nearly 50% improved dramatically with 800 IU daily of vitamin E. These are the reasons why a high dose of vitamin E is required. Use only natural vitamin E which is known as d-alpha tocopherol.
It is vital to obtain plenty of beta-carotene and its related carotenoids from eating a wide variety of raw brightly colored fruits and vegetables. Beta-carotene is converted in the body to vitamin A. Beta-carotene, other carotenoids and vitamin A, have a powerful anti-cancer effect in those with cirrhosis. This will reduce the risk of cirrhotic livers developing cancer. Those with liver disease need to be careful not to take excessive amounts of vitamin A and should not take more than 10,000 IU daily.
Selenium has been shown in clinical studies to reduce the incidence of liver cancer and should be taken daily by those with cirrhosis and/or other risk factors for liver cancer. For more information see the websitewww.seleniumresearch.com
Take a that contains the essential nutrients to support the liver’s ability to break down and excrete toxins. This will reduce the damage that toxins can inflict upon liver cells and support the repair of damaged liver cells. For cirrhosis, I would recommend a daily liver tonic that contains Milk Thistle, B vitamins, sulfur containing amino acids and Selenium.
should be taken in a dose of 600mg three times daily to help the damaged liver to make more glutathione.
Vitamin K – many people with cirrhosis have a problem with bruising or bleeding from enlarged veins in the esophagus. This is because the damaged liver cells are unable to manufacture sufficient amounts of clotting factors. This can be helped by the daily consumption of a fresh juice made with a mixture of raw dark green leafy vegetables. Good vegetables to use for this purpose are spinach, kale, beetroot tops, parsley, mint, watercress, wheatgrass and alfalfa sprouts which are high in vitamin K. Vitamin K will help to reduce this deficiency of clotting factors and will reduce bruising and bleeding.

General Measures for cirrhosis

Minimize the use of all medications, especially liver toxins such as alcohol, analgesic drugs (especially acetaminophen, paracetamol and narcotics) and anti- inflammatory drugs. Avoid using household and workplace chemicals such as insecticides, pesticides, chlorine, bleach, paints, glues and solvents.
Protein Intake – the cirrhotic liver cannot handle large amounts of concentrated protein at once time and for this reason minimize the consumption of red meat and poultry. If you eat too much animal protein, ammonia levels will build up in the blood stream causing fatigue and mental confusion. and  supplements help to reduce ammonia levels in the body.  Suitable protein sources are legumes (beans, peas and lentils), grains, cereals, seeds, sprouts and nuts.
Avoid constipation by consuming plenty of raw fruits and vegetables, and grind fresh seeds (flaxseed, pumpkinseed, sunflower seeds etc) and almonds to increase intestinal fiber. powder is excellent to increase necessary fiber bulk in the bowel. This increased fiber will speed the passage of toxins out of the bowels and reduce the ability of these toxins to re-circulate back to the liver. The laxatives Osmolax and Lactulose are also good products to draw fluid into the bowel to ease constipation.
If bowel function is poor because of constipation with high amounts of bacteria in the bowel, this can lead to excessive fermentation of the bowel contents, which will increase absorption of toxic ammonia from the bowel. A healthy liver can convert nitrogen into urea, which is excreted in the urine. In patients with end stage cirrhosis and very poor liver function, the liver is not able to handle these high levels of ammonia and toxic brain symptoms may occur. In this situation bowel function should be improved by increasing raw food fiber and taking supplements of the healthy lactobacillus bacteria. Enemas and colonic irrigations can also help if there is severe constipation and auto-intoxication from the bowel.
Fifty percent of your diet should consist of raw and cooked vegetables and fruits. Dressings can be made with organic apple cider vinegar and cold pressed olive oil. Drink one or two glasses of daily.
Eat cruciferous vegetables including broccoli, cauliflower, Brussels sprouts, kale, cabbage, bok choy and watercress, as well as garlic and onions to help the detoxification ability of the liver.
Ask your doctor to check that your body’s total iron content is within normal limits. This can be confirmed with a simple blood test known as serum iron studies. Excess iron can increase liver damage and cause cirrhosis. If your iron levels are excessively high, avoid iron-enriched cereals, vitamin pills containing iron and liver.