Browsing the archives for the linux category.

LaTeX on Debian 8

ai-tee, linux

TeX Live Installation

$ sudo apt-get install texlive-full
$ http://download.opensuse.org/repositories/home:/jsundermeyer/Debian_8.0/amd64/texstudio_2.12.4-3.1_amd64.deb

TeXstudio installation

$ sudo dpkg -i texstudio_2.12.4-3.1_amd64.deb
$ sudo apt-get install -f

Texmaker installation

$ sudo dpkg -i texmaker_debian_jessie_4.5_amd64.deb
$ sudo apt install -f

Sublime installation

$ wget https://download.sublimetext.com/sublime-text_build-3126_amd64.deb
$ sudo dpkg -i sublime-text_build-3126_amd64.deb

Source:

Comments Off on LaTeX on Debian 8

Wildcard SSL Certificate Installation on Zimbra Mail Server

ai-tee, linux

Prepare the necessary files:

  • commercial.key
    Contains private key that is used to generate CSR (for a wildcard certificate, this private key can be from another machine from a same domain)
  • commercial.crt
    Contains a commercial SSL certificate that is generated by a CA, such as “RapidSSL Wildcard certificate” in my case
  • ca_bundle.crt
    Contains CA’s bundle such as “RapidSSL/Wildcard SHA-2 under SHA-1 root” from https://www.namecheap.com/support/knowledgebase/article.aspx/9393/69/where-do-i-find-ssl-ca-bundle)

Installation steps:

# su zimbra
$ ls /opt/zimbra/ssl/zimbra/commercial/
commercial.key
$ ls /tmp/ssl/
ca_bundle.crt  commercial.crt
$ zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key /tmp/ssl/commercial.crt /tmp/ssl/ca_bundle.crt
** Verifying '/tmp/ssl/commercial.crt' against '/opt/zimbra/ssl/zimbra/commercial/commercial.key'
Certificate '/tmp/ssl/commercial.crt' and private key '/opt/zimbra/ssl/zimbra/commercial/commercial.key' match.
** Verifying '/tmp/ssl/commercial.crt' against '/tmp/ssl/ca_bundle.crt'
Valid certificate chain: /tmp/ssl/commercial.crt: OK
$ zmcertmgr deploycrt comm /tmp/ssl/commercial.crt /tmp/ssl/ca_bundle.crt
...
** Copying '/tmp/ssl/commercial.crt' to '/opt/zimbra/ssl/zimbra/commercial/commercial.crt'
** Copying '/tmp/ssl/ca_bundle.crt' to '/opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt'
** Appending ca chain '/tmp/ssl/ca_bundle.crt' to '/opt/zimbra/ssl/zimbra/commercial/commercial.crt'
** Importing cert '/opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt' as 'zcs-user-commercial_ca' into cacerts '/opt/zimbra/common/lib/jvm/java/jre/lib/security/cacerts'
** NOTE: restart mailboxd to use the imported certificate.
...
$ zmcontrol restart
$ zmcertmgr viewdeployedcrt

Verification:

Verify using https://www.ssllabs.com/ssltest/

Source:

Comments Off on Wildcard SSL Certificate Installation on Zimbra Mail Server

Optimizing Debian on Laptop

ai-tee, linux

TLP (advanced power management for Linux)

# echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install tlp tlp-rdw
# tlp start
# tlp-stat -s

Source:


Brightness Adjusment

Create a script:

# vim brightness.sh
# chmod +x brightness.sh

Content of “brightness.sh” script

function main_menu
{
    sudo clear
    cursetting=$(cat /sys/class/backlight/intel_backlight/brightness)
    maxsetting=$(cat /sys/class/backlight/intel_backlight/max_brightness)
    powersave=$((maxsetting/5))
    conservative=$((powersave*2))
    medium=$((powersave*3))
    performance=$((powersave*4))
    echo ""
    echo "----------------------- Brightness -----------------------"
    echo " 1. Set Display to Minimum (Powersave) brightness setting."
    echo " 2. Set Display to Low (Conservative) brightness setting."
    echo " 3. Set Display to Medium brightness setting."
    echo " 4. Set Display to High (Performance) brightness setting."
    echo " 5. Set Display to Maximum brightness setting."
    echo " 6. Exit."
    echo "----------------------------------------------------------"
    if [ $cursetting -eq $powersave ]; then
     cursetting='Minimum'
    else
     if [ $cursetting -eq $conservative ]; then
      cursetting='Conservative'
     else
      if [ $cursetting -eq $medium ]; then
       cursetting='Medium'
      else
       if [ $cursetting -eq $performance ]; then
        cursetting='Performance'
       else
        if [ $cursetting -eq $maxsetting ]; then
         cursetting='Maximum'
        fi
       fi
      fi
     fi
    fi
    echo "        Current Display Setting - "$cursetting;
    choice=7
    echo ""
    echo -e "Please enter your choice: \c"
}

function press_enter
{
    echo ""
    echo -n "Press Enter to continue."
    read
    main_menu
}

main_menu
while [ $choice -eq 7 ]; do
read choice

if [ $choice -eq 1 ]; then
 echo $powersave | sudo tee /sys/class/backlight/intel_backlight/brightness
 main_menu
else
 if [ $choice -eq 2 ]; then
  echo $conservative | sudo tee /sys/class/backlight/intel_backlight/brightness
  main_menu
 else
  if [ $choice -eq 3 ]; then
   echo $medium | sudo tee /sys/class/backlight/intel_backlight/brightness
   main_menu
  else
   if [ $choice -eq 4 ]; then
    echo $performance | sudo tee /sys/class/backlight/intel_backlight/brightness
    main_menu
   else
    if [ $choice -eq 5 ]; then
     echo $maxsetting | sudo tee /sys/class/backlight/intel_backlight/brightness
     main_menu
    else
     if [ $choice -eq 6 ]; then
      exit;
     else
      echo -e "Please enter the NUMBER of your choice: \c"
      choice = 7
     fi
    fi
   fi
  fi
 fi
fi
done

Source


Add Sudo user

# apt-get install sudo
# adduser [new-user]
# adduser [new-user] sudo

If it is still failed, add the [new-user] directly with visudo

# visudo
Add the [new-user] on this section # User privilege specification
root ALL=(ALL:ALL) ALL
[new-user] ALL=(ALL:ALL) ALL

Source:


UTC or Local Time Management

Synchronizing UTC or local time between two OS (Windows and Linux) in dual boot Laptop.

$ sudo timedatectl
      Local time: Thu 2017-05-11 21:42:06 WIB
  Universal time: Thu 2017-05-11 14:42:06 UTC
        RTC time: Thu 2017-05-11 14:42:06
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
$ sudo timedatectl set-local-rtc 1
$ sudo timedatectl
      Local time: Thu 2017-05-11 21:45:00 WIB
  Universal time: Thu 2017-05-11 14:45:00 UTC
        RTC time: Thu 2017-05-11 21:45:00
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Source:


Remote Desktop Protocol

$ sudo apt-get install rdesktop

Source:


TeamViewer

$ wget https://downloadus1.teamviewer.com/download/version_12x/teamviewer_12.0.76279_i386.deb
$ sudo dpkg -i teamviewer_12.0.76279_i386.deb
$ sudo apt-get install -f

Source:


Improve Font Rendering

Subpixel-hinting and Font-smoothing
Create a file “.fonts.conf” in the home folder

$ more ~/.fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>

Install Infinality

$ more /etc/apt/sources.list
...
deb http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
...
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E985B27B
$ sudo apt-get update
$ sudo apt-get install fontconfig-infinality
$ sudo bash /etc/fonts/infinality/infctl.sh setstyle
Select a style:
1) debug       3) linux          5) osx2         7) win98
2) infinality  4) osx          6) win7         8) winxp
#? 3
conf.d -> styles.conf.avail/linux
$ more /etc/profile.d/infinality-settings.sh
...
# USE_STYLE="DEFAULT"
USE_STYLE="UBUNTU"
...

Install Ubuntu Font

$ wget http://mirrors.kernel.org/ubuntu/pool/main/u/ubuntu-font-family-sources/ttf-ubuntu-font-family_0.80-0ubuntu6_all.deb
$ sudo dpkg -i ttf-ubuntu-font-family*.deb
$ sudo apt-get install gnome-tweak-tool
$ gnome-tweak-tool

Configure Fonts on gnome-tweak-tool:

  • Window Titles [ Ubuntu Regular – 11 ]
  • Interface [ Ubuntu Regular – 11 ]
  • Documents [ Ubuntu Regular – 11 ]
  • Monospace [ Ubuntu Mono Regular – 13 ]
  • Hinting [ Slight ]
  • Antialiasing [ Rgba ]
  • Scaling Factor [ 1.00 ]

Install Microsoft Font

$ sudo apt-get install ttf-mscorefonts-installer
$ wget http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe
$ unar PowerPointViewer.exe
$ cd PowerPointViewer/
$ unar ppviewer.cab
$ cd ppviewer/
$ mkdir ~/.fonts
$ cp *.TTF *.TTC ~/.fonts

Logout and login again to see the change.

Source:


Browser

Chrome install

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg -i google-chrome-stable_current_amd64.deb

Source:


Show Desktop

Settings => Keyboard => Shortcut => Navigation => Hide all normal windows (Super + D)

Source:


Printer Management

$ sudo apt install cups

Open http://localhost:631/admin

Source:


Change Python Version 2 to 3

$ ls /usr/bin/python*
/usr/bin/python3.4 /usr/bin/python2.7
$ python --version
Python 2.7.9
$ sudo update-alternatives --list python
update-alternatives: error: no alternatives for python
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode
$ python --version
Python 3.4.2

Back again to version 2 or vice versa:

$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.4 2 auto mode
 1 /usr/bin/python2.7 1 manual mode
 2 /usr/bin/python3.4 2 manual mode
Press enter to keep the current choice[*], or type selection number: 

Sources:

Comments Off on Optimizing Debian on Laptop

Upgrading Debian Wheezy (7) to Jessie (8)

linux

I’ve just upgraded a Debian server from Wheezy to Jessie with these steps:

# apt-get update && apt-get upgrade && apt-get dist-upgrade
# dpkg --audit && dpkg --get-selections | grep hold
# vim /etc/apt/sources.list
[add these list - for Indonesian user]
deb http://kambing.ui.ac.id/debian/ jessie main contrib non-free
deb-src http://kambing.ui.ac.id/debian/ jessie main contrib non-free
deb http://kambing.ui.ac.id/debian/ jessie-updates main contrib non-free
deb-src http://kambing.ui.ac.id/debian/ jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
# apt-get update && apt-get upgrade && apt-get dist-upgrade
# more /etc/debian_version && more /etc/os-release
# reboot

Add apache-mysql-php:

# apt-get install mysql-server mysql-client
# apt-get install apache2 apache2-doc
# apt-get install php5 libapache2-mod-php5 php5-mysql
# service apache2 restart

Source:
https://www.howtoforge.com/tutorial/how-to-upgrade-debian-wheezy-to-jessie-stable-release/

Comments Off on Upgrading Debian Wheezy (7) to Jessie (8)

Error Restarting Network Service in CentOS 7

linux

Today I got this error message when restarting network service with # systemctl restart network.service or # service network restart:

Restarting network (via systemctl): Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.

Browsing around for a while, then found this solution:

# systemctl stop NetworkManager
# systemctl disable NetworkManager

After disabling NetworkManger, restarting network service succeeded.

Source:
http://unix.stackexchange.com/questions/220750/centos-7-failed-to-bring-up-down-networking-configure-interface-for-a-trunk-in
http://www.linuxquestions.org/questions/linux-newbie-8/centos-7-failed-to-bring-up-down-networking-configure-interface-for-a-trunk-interfa-4175550117/

Comments Off on Error Restarting Network Service in CentOS 7

Apt-get update error

linux, server

As Debian big fan, sometime I found that apt-get update command reveal this error:
“E: Some index files failed to download. They have been ignored, or old ones used instead.”

This command is very simple solution I found:

# rm /var/lib/apt/lists/partial/*

After that, apt-get update && apt-get upgrade command should be fine.

Source:
http://forums.debian.net/viewtopic.php?f=10&t=108618

Comments Off on Apt-get update error

Clean /boot Partition in CentOS 6

linux, server

/boot Partition in CentOS 6 can be cleaned by removing old kernels.

These are the steps:

1. Check /boot partition (98% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   86M  2.1M  98% /boot
...

2. Check installed kernel

# rpm -q kernel
kernel-2.6.32-431.el6.x86_64
kernel-2.6.32-431.29.2.el6.x86_64
kernel-2.6.32-504.1.3.el6.x86_64

3. Install package-cleanup

# yum install yum-utils
# package-cleanup --oldkernels --count=2
=======================================================================================================================================
 Package              Arch                 Version                        Repository                                              Size
=======================================================================================================================================
Removing:
 kernel               x86_64               2.6.32-431.el6                 @anaconda-CentOS-201311272149.x86_64/6.5               121 M

Transaction Summary
=======================================================================================================================================
Remove        1 Package(s)

Installed size: 121 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 
  Verifying  : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 

Removed:
  kernel.x86_64 0:2.6.32-431.el6                                                                                                       

Complete!

4. Check /boot partition (67% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   59M   30M  67% /boot
...

5. Limit only 2 latest kernel for later updates

# vim /etc/yum.conf
   ...[edit yum.conf]...
   installonly_limit=2
   ...[edit yum.conf]...

Source:
http://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/

Comments Off on Clean /boot Partition in CentOS 6

SSH Server Administration

linux, server

Having several Linux Servers, SSH access is mandatory communication between me and those servers. These are several tips for SSH Server administration that save the day:

Add these line on /etc/ssh/sshd_config:

  • Allow only specific user (never use root login for remote SSH access)
    AllowUsers username
    DenyUsers All
  • Disable DNS and GSSAPI (solving slow login respond, especially from private network)
    UseDNS no
    GSSAPIAuthentication no

Make sure to restart SSH service after changing sshd_config:

# service ssh restart

or

# /etc/init.d/ssh restart

Additional tip:

  • Add this options on /etc/resolv.conf (solving slow login respond on RHEL/CentOS)
options single-request-reopen

Source:

http://injustfiveminutes.com/2013/03/13/fixing-ssh-login-long-delay/

Comments Off on SSH Server Administration

SquidAnalyzer Installation

linux, server

Environment:
– Linux Debian 7.7 (amd64)
– Squid Cache 3.1.20

Preparation:
– Download SquidAnalyzer-6.1 from http://sourceforge.net/projects/squid-report/

Installation:

# tar -zxvf squidanalyzer-6.1.tar.gz
# cd squidanalyzer-6.1
# perl Makefile.PL
# make
# make install
# vim /etc/apache2/sites-enabled/000-default
    ...[add to 000-default file]...
        <Directory /var/www/squidanalyzer>
            Options -Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    ...[add to 000-default file]...
# service apache2 restart
# /usr/local/bin/squid-analyzer
# crontab -e
    ...[edit crontab]...
    0 2 * * * /usr/local/bin/squid-analyzer > /dev/null 2>&1
    ...[edit crontab]...

Note:
– use .htaccess to protect page

Source:
http://squidanalyzer.darold.net/install.html

Comments Off on SquidAnalyzer Installation

SARG (Squid Analysis Report Generator) Installation

linux, server

Environment:
– Linux Debian 7.7 (amd64)
– Squid Cache 3.1.20

Preparation:
– Get the latest update from repository #apt-get update

Installation:

# apt-get install sarg
# vim /etc/sarg/sarg.conf
    ...[edit sarg.conf]...
    access_log /var/log/squid3/access.log
    date_format e
    overwrite_report yes
    output_dir /var/www/sarg
    ...[edit sarg.conf]...
# /usr/bin/sarg -x
# crontab -e
    ...[edit crontab]...
    0 2 * * * /usr/bin/sarg -x
    ...[edit crontab]...

Note:
– Open http://Server-IP-Address/sarg to operate SARG

Source:
http://www.tecmint.com/sarg-squid-analysis-report-generator-and-internet-bandwidth-monitoring-tool/

Comments Off on SARG (Squid Analysis Report Generator) Installation
« Older Posts