Configuring ddclient

ddclient updates IP addresses at dynamic DNS services.

# install ddclient
$ sudo apt-get install ddclient

Configuring dyndns.com

Selected dyndns.com in the installation process and followed the prompts. Did not need to manually enter anything.

Configuring namecheap.com

Enable Dynamic DNS for your domain
Login to your Namecheap control panel and enable dynamic DNS for your domain.
You’ll get a really long password string to use. Save that for now as you’ll need it later on.
namecheap dynamic dns password

$ sudo nano /etc/ddclient.conf

# namecheap.com example configuration
# the login is the domain name and password is the hash you saved in the prior step called ‘Dynamic DNS Password’.

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=namecheap
use=web, web=dynamicdns.park-your-domain.com/getip, web-skip='IP Address'
server=dynamicdns.park-your-domain.com
login=baligena.com
password='36e39d6fief87be5e38c7d7507863'
@,www

# remove cache
$ sudo rm /var/cache/ddclient/ddclient.cache

# force update, you may need to delete cache
$ sudo ddclient --daemon=0 --debug --verbose --noquiet

# another configuration file
$ sudo nano /etc/default/ddclient
# to enable automatic updates you must enable the daemon, see specified settings

run_dhclient="false"
run_ipup="false"
run_daemon="true"
daemon_interval="300"

# restart ddclient
$ sudo /etc/init.d/ddclient restart

source:

tags:
ddns, Dynamic DNS

Setting up Ubuntu Server on Laptop

Dell Latitude D630

Ubuntu Adding Packages

When attempting to install a program thru apt-get the most frustrating moment is when the program cannot be found and what’s worst is not being able to add the package to install the program. In the past attempting to add packages by editing /etc/apt/sources.list has been unsuccessful but success has came from adding thru “apt-add-repository” command line command. Here are examples.

Where to find packages
https://launchpad.net/ubuntu/+ppas
ppa packages info

To install cmake:
# https://launchpad.net/~kalakris/+archive/cmake
$ sudo apt-add-repository ppa:kalakris/cmake
$ sudo apt-get update
$ sudo apt-get install cmake

To install emacsen-common:
# http://www.ubuntuupdates.org/ppa/kubuntu-ppa_backports?dist=precise
$ sudo add-apt-repository ppa:kubuntu-ppa/backports
$ sudo apt-get update
$ sudo apt-get install emacsen-common

To install cheese
# http://packages.ubuntu.com/precise/i386/cheese/download
# adding a line to your /etc/apt/sources.list like this:
deb http://cz.archive.ubuntu.com/ubuntu precise main universe
$ nano /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get install cheese

View package info

$ apt-cache policy [package name]
# apt-cache policy cheese

Stop ubuntu from Hibernating, fixing crontab

Recently I was having issues with cron not executing between the times of 10pm to 9am and when I didn’t access the server for an extended period of time. The issue I found was that my server was hibernating/sleeping at those times and cron doesn’t execute if that happens. My ubuntu server doesn’t have a GUI so everything needs to be configured in the command line. So here is what I did.

edit the grub file:

$ sudo nano /etc/default/grub

Add the kernel options “acpi=off apm=off” to the GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="acpi=off apm=off"

Then run:

$ sudo update-grub

Reboot your computer.

Resources:
http://unix.stackexchange.com/questions/25133/ubuntu-server-continuously-goes-to-sleep/25151#25151
http://askubuntu.com/questions/47311/how-do-i-disable-my-system-from-going-to-sleep

tag:
turn off ubuntu server hibernation

Multiple Remote Virtual host and sub domains

Just by doing whats below the server will automatically recognize if its requesting baligena.com or felipe.baligena.com and navigate to the correct page. No additional configuration is necessary, everything to make subdomains and virtual host work is here.


$ sudo nano /etc/apache2/sites-available/baligena.com

    # domain: baligena.com
    # public: /var/www/mulsite/

    <virtualhost *:80>

      # Admin email, Server Name (domain name) and any aliases
      ServerAdmin webmaster@baligena.com
      ServerName  baligena.com
      ServerAlias www.baligena.com


      # Index file and Document Root (where the public files are located)
      DocumentRoot /var/www/mulsite/
    </virtualhost>

$ sudo a2ensite baligena.com
$ sudo service apache2 reload

Resource:
https://www.linode.com/wiki/index.php/Configure_apache_to_use_virtual_hosts_on_ubuntu_server


For subdomain:
configure you dns provider godaddy or namecheap.com
https://community.namecheap.com/forums/viewtopic.php?f=6&t=193

$ sudo nano /etc/apache2/sites-available/baligena.com

    # domain: felipe.baligena.com
    # public: /var/www/mulsite/

    <virtualhost *:80>

      # Admin email, Server Name (domain name) and any aliases
      ServerAdmin webmaster@baligena.com
      ServerName felipe.baligena.com
      ServerAlias www.felipe.baligena.com


      # Index file and Document Root (where the public files are located)
      DocumentRoot /var/www/mulsite
    </virtualhost>

$ sudo a2ensite baligena.com
$ sudo service apache2 reload


the default page should be /var/www/

tags:
sub domains

Change default editor Ubuntu

Changing the default editor from gedit to sublime text

1. Download Sublime Text

2. Make a symbolic link of the executable file
$ ln -s “/home/bigbang/Desktop/Sublime Text 2/sublime_text” /usr/bin/sublime_text

3. Make an executable file desktop file
$ sublime_text /usr/share/applications/sublime.desktop
Inside sublime.desktop:

[Desktop Entry]
Version=2.0.1
Name=Sublime Text 2
Encoding=UTF-8
Comment=Advanced Code and Text Editor
Exec=sublime_text %F
Icon=/home/bigbang/Desktop/Sublime Text 2/Icon/256×256/sublime_text.png
Terminal=false
Type=Application
Categories=Developer;

** you should have an executable file in the dash **

4.replace all occurrences of gedit.desktop with sublime.desktop.
$ sudo sublime_text /usr/share/applications/defaults.list

Resources:
http://sajan.io/618/setting-sublime-text-2-as-default-editor-in-ubuntu/
http://sajan.io/599/install-sublime-text-2-on-ubuntu-video/

Sublime Text 2 as Default Editor in Ubuntu 12.04


http://askubuntu.com/questions/162612/how-can-i-add-an-application-to-the-list-of-open-with-applications#answer-162656

Multiple Sites on One Server – Virtual Hosts

This works for Ubuntu

Go to your site directory and make two folder site1.com and site2.com
$ mkdir /var/www/site1.com /var/www/site2.com

Modify your host file
$ sudo nano /etc/hosts

Add the two lines of code into that file
127.0.0.1 site1.com
127.0.0.1 site2.com

Make configuration changes to apache by creating 2 files in the /etc/apache2/sites-available directory
$ sudo touch /etc/apache2/sites-available/site1.com /etc/apache2/sites-available/site2.com

Put this code in those new created file.
site1.com file:
<VirtualHost *:80>
DocumentRoot /var/www/site1.com
ServerName www.site1.com
ServerAlias site1.com
</VirtualHost>

site2.com file:
<VirtualHost *:80>
DocumentRoot /var/www/site2.com
ServerName site2.com
ServerAlias site2.com
</VirtualHost>

Final configuration commands
$ sudo a2ensite site1.com
$ sudo a2ensite site2.com
$ sudo service apache2 reload

Now if you put either site1.com or site2.com in your browser you’ll go to those sites. Now if you own these domain names put you internet IP address with the domain hosting and it will automatically navigate to the specified site location, making accessibility public.


if error:
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

$ sudo nano /etc/apache2/httpd.conf

add the line below:
ServerName localhost

Resource.

tags:
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

Corrupted dpkg status file fix

Today I was trying to install a program using apt-get install however I kept getting this error

.
.
.
Do you want to continue [Y/n]? Y
Selecting previously unselected package libxmlrpc-core-c3.
(Reading database … 60%dpkg: unrecoverable fatal error, aborting:
reading files list for package ‘intltool-debian’: Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)

after hours of research I found out that the reason for this error was the /var/lib/dpkg/status file was corrupted.

I had three options to fix this which were reinstall ubuntu operating system, edit the status files or find a backup status file. I didn’t want to reinstall my operating system so I tried the other two.

(warning: Before trying to edit any file make sure you make a back up of it)

I tried to edit the status file by looking for the package I was trying to install. However I couldn’t find it and I didn’t know what to delete. Luckly there’s dpkg status backupfiles in your system located at /var/backups. I found one that was created a month ago called dpkg.status.3.gz and extracted it and renamed the file status and put into /var/lib/dpkg directory.

Then I tried to install the program using apt-get install and it worked.