Search This Blog

Showing posts with label Uncategorised. Show all posts
Showing posts with label Uncategorised. Show all posts

Wednesday, March 23, 2016

etckeeper Debian Jessie howto

etckeeper is another great tool for keep a recorder of /etc configuration files changes on your Linux box.

First install etckeeper, it is simple on Debian Jessie:
# apt-get install etckeeper

Generate the key for git server:
root@milliondollarserver:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20 root@milliondollarserver
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|                 |
|        o        |
|       oSo E     |
|        +.... .. |
|       .....o .+=|
|         ..o +.**|
|           .o.=.B|
+-----------------+

Setup Git:
root@milliondollarserver:~# git config --global user.email root@milliondollarserver.com
root@milliondollarserver:~# git config --global user.name root@milliondollarserver
root@milliondollarserver:~# cd /etc/
root@milliondollarserver:/etc# etckeeper init
root@milliondollarserver:/etc# git commit -m "initial checkin"
[master 7c33032] initial checkin
 4 files changed, 14 insertions(+), 4 deletions(-)
 delete mode 100644 check_mk/mysql.cfg
 create mode 100644 python/debian_config
 create mode 100644 python2.7/sitecustomize.py

Hook it up with my Git server:
cd /etc
git remote rm origin
git remote add origin gitolite3@git.milliondollarserver.com:etckeeper-milliondollarserver

Add auto push:
cd /etc/etckeeper/commit.d
(echo ‘#!/bin/sh’ ; echo ‘git push origin’) > 60git-push
chmod +x 60git-push

Try to push:
cd /etc
git add .
git commit -m “automatically push commits to backup repository”
/etc# git push

You will got warning:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


Run these 2 command to push:
:/etc# git config --global push.default simple
:/etc# git push --set-upstream origin master


You should have output like this:
The authenticity of host 'git.milliondollarserver.com (10.10.10.10)' can't be established.
ECDSA key fingerprint is f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20:f2:20.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'git.milliondollarserver.com,10.10.10.10' (ECDSA) to the list of known hosts.
Counting objects: 1080, done.
Compressing objects: 100% (717/717), done.
Writing objects: 100% (1080/1080), 498.42 KiB | 0 bytes/s, done.
Total 1080 (delta 109), reused 0 (delta 0)
To gitolite3@git.milliondollarserver.com:etckeeper-sca-app-lb01
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Redmine 3.2.1 bare server running on Debian Jessie

Need Upgrade Redmine to the latest stable 3.2.1.

Download the latest stable package:
cd /var/www
wget http://www.redmine.org/releases/redmine-3.2.1.tar.gz
tar xzvf redmine-3.2.1.tar.gz
chown -R root:root redmine-3.2.1/

Copy the configure file and SQLite database file:
cp /var/www/redmine-3.2.0/config/configuration.yml /var/www/redmine-3.2.1/config/configuration.yml
cp /var/www/redmine-3.2.0/config/database.yml /var/www/redmine-3.2.1/config/database.yml
cp /var/www/redmine-3.2.0/db/redmine.sqlite3 /var/www/redmine-3.2.1/db/redmine.sqlite3

Perform upgrade:
cd /var/www/redmine-3.2.1
bundle install --without development test rmagick
bundle exec rake generate_secret_token
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production

Testing Run:
ruby /var/www/redmine-3.2.1/bin/rails server webrick -e production -b 192.168.1.33 -p 80

And to start Redmine automatic on boot:

My latest service script /etc/init.d/redmine:
#!/bin/sh
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redmine webrick
# Description: redmine webrick server autostart-script
### END INIT INFO

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="redmine webrick daemon"
NAME=redmine
PIDFILE=/var/run/redmine.pid
SCRIPTNAME=/etc/init.d/"$NAME"

. /lib/lsb/init-functions

# Modify it to your configuration
DIR=/var/www/redmine-3.2.1/

# Start Redmine in daemon mode.
do_start(){
cd $DIR
ruby /var/www/redmine-3.2.1/bin/rails server webrick -e production -b 192.168.1.33 -p 80 > /var/log/redmine.log
}

# Stop Redmine daemon
do_stop(){
RUBYPID=`ps aux | grep "ruby /var/www/redmine-3.2.1/bin/rails server webrick" | grep -v grep | awk '{print $2}'`
if [ "x$RUBYPID" != "x" ]; then
kill -2 $RUBYPID
fi
}

# Check if Redmine is running
do_status(){
RUBYPID=`ps aux | grep "ruby /var/www/redmine-3.2.1/bin/rails server webrick" | grep -v grep | awk '{print $2}'`
if [ "x$RUBYPID" = "x" ]; then
echo "* Redmine is not running"
else
echo "* Redmine is running"
fi
}


case "$1" in
start)
do_start
;;

stop)
do_stop
;;

status)
do_status
;;

restart|force-reload)
do_stop
do_start
;;

*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1

esac

Don't forgot active the service in Debian Jessie:
update-rc.d redmine defaults
systemctl daemon-reload
service redmine start
service redmine status


Please notice my local Redmine server IP is: [192.168.1.33].
You will replace it with your own IP address.

check_mk OMD apt plugin

Thanks for the great work from [Karsten Schoeke, Stefan Schlesinger]
https://github.com/lgbff/lgb_check_mk_plugins/tree/master/aptng

This plugin can check for available updates via apt-get on Debian or Ubuntu.
$ wget https://mathias-kettner.de/check_mk_exchange_file.php?HTML=&file=apt-2.7.mkp
# su - milliondollarserver_monitor
$ check_mk -P install /tmp/apt-2.7.mkp

$ check_mk -vP list
Name Title            Files
---- ---------------- -----
apt  apt Update check 4

It won't pull the apt data automaticly, to do so.
I add a cron job to apt-get update to trigger the new data every day:
(echo '#!/bin/sh' ; echo '/usr/bin/apt-get update') > /etc/cron.daily/apt-get-update
chmod +x /etc/cron.hourly/apt-get-update

Reference: http://www.planet4.se/upgrade-check_mk-omd-and-install-mkp-files/

Please notice [milliondollarserver_monitor] is my local OMD project, you will have to replace it by your own project name.

Wednesday, March 9, 2016

Debian Jessie turn off IPv6

Append ipv6.disable=1 to the GRUB_CMDLINE_LINUX variable in /etc/default/grub.


GRUB_CMDLINE_LINUX="ipv6.disable=1"


Run update-grub and reboot.
or better,

edit /etc/sysctl.conf and add those parameters to kernel. Also be sure to add extra lines for other network interfaces you want to disable IPv6.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1


After editing sysctl.conf, you should run sysctl -p to activate changes or reboot system.

Reference:
https://wiki.debian.org/DebianIPv6

Thursday, January 30, 2014

Dell Wyse Cloud Connect

http://www.dell.com/us/business/p/cloud-connect/pd

This is really a thin client device.

Android 4.1, Jelly Bean runs on Cortex-A9 ARM SOC
With Wifi

Memory:

8GB flash
1 GB RAM
1x Micro SD card slot (expandable up to 72GB flash storage)

Wednesday, December 4, 2013

Maximum Number of Files in a Single Directory for Netapp NFS mounts on Linux: maxdirsize

Hit file number limit on Netapp NFS mount.

The parameter is [maxdirsize]

Starting with Data ONTAP 6.5, the maximum number of subdirectories a single directory may have is 99998 (100K). Data ONTAP 6.4 and earlier versions were restricted to 65534 (64K) subdirectories. This number may not be changed. To understand the reason for this limit, see the section below on hard links and subdirectory implementation.

And the size of it also has limit which is 1% of Memory.
It has too be less than 80 MB on a 8GB Memory Netapp unit.

You can increase this parameter on line for individual volume.

For the best performance:

# The most important point is to avoid a high number of files in a single directory.
# Create sub-directory structures and place files at the bottom of the directory tree.
# Less than 1000 files per directory is ideal.
# Avoid deep directory structures.
# A depth of less than 5 is ideal, anything above 8 or 9 results in poor performance.

What are the performance impacts of changing the size of maxdirsize?

Performance issues are hard to quantify, but easy to state in a general sense. Lookups in a large directory consume lots of CPU. An additional
performance impact is that when a directory is loaded into memory, the entire directory tree is loaded. Parts of it may fall out of memory
through non-use, but there is a performance impact from reading from disk and finding space in-memory for the directory to be stored.
Hope this helps ,

References:
http://serverfault.com/questions/76018/maximum-number-of-files-in-a-single-directory-for-netapp-nfs-mounts-on-linux
http://source.kohlerville.com/2009/01/post-about-wafldirsizemax/
https://communities.netapp.com/message/5790;jsessionid=7D859DAC2D127BAF4C4D53A5157E060D

Emergency Solution:


find /home/lambert/backup -mtime +{days back} | xargs rm

Saturday, February 16, 2013

Installing the Webmin RPM

Using the Webmin YUM repository

If you like to install and update Webmin via RPM, create the /etc/yum.repos.d/webmin.repo file containing:

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1


You should also fetch and install my GPG key with which the packages are signed, with the commands:

wget http://www.webmin.com/jcameron-key.asc
rpm --import jcameron-key.asc


You will now be able to install with the command :

yum install webminAll


dependencies should be resolved automatically.

To allow access add the new iptables roule:

vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

service iptables restart

Sunday, December 2, 2012

Device eth0 does not seem to be present after move copy VM

Device eth0 does not seem to be present, delaying initialization. [FAILED]

Got this message after copy a VM to another location.

What I am trying to do is clone a VM.

This happens under VMWare ESXi 5 and other products.

The reason is VMWare gave the VM you moved or copied one for few new NIC.

If check the file: /etc/udev/rules.d/70-persistent-net.rules

You will found the old NIC eth0 still there and the new NIC becomes eth1 etc...

But the eth0 does not exist anymore.

This is a safe protect by RED HAT.

To fix this issue, my solution:

# rm -f /etc/udev/rules.d/70-persistent-net.rules
# reboot


The 70-persistent-net.rules will be generate automatic after reboot.

Then just modify /etc/sysconfig/network-scripts/ifcfg-ethx 's MAC
You are back!

Thursday, November 29, 2012

Setup NFS from Oracle Enterprise Linux 6 basic install

After basic install Oracle Enterprise Linux 6, it will not easy to pick up NFS share.

Here is my steps:

1.Install rpcbind and nfs-utils

yum install rpcbind nfs-utils
chkconfig rpcbind on
service rpcbind start


To check rpc info:
rpcinfo -p


To check available nfs mount from nfshost(192.168.1.200 as example)

showmount -e 192.168.1.200


2.Mount nfs manually

# mkdir /nfsbackup
# mount 192.168.1.200:/mnt/test /nfsbackup/


To check mount status:
# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
19306716 1503088 16825700 9% /
tmpfs 12371100 0 12371100 0% /dev/shm
/dev/sda1 495844 53039 417205 12% /boot
/dev/sdb1 10320184 193872 9602076 2% /var/log
/dev/sdc1 51605436 22952412 26031620 47% /pgsql
/dev/sdd1 30961664 4958796 24430108 17% /tmp
/dev/sdf1 41279536 5682164 33500492 15% /home
192.168.201.200:/mnt/test
511967200 32 511967168 1% /nfsbackup


3.Mounting NFS File Systems using /etc/fstab

The general syntax for the line in /etc/fstab is as follows:
server:/usr/local/pub    /pub   nfs    rsize=8192,wsize=8192,timeo=14,intr


A sample /etc/fstab line to mount an NFS export looks like the following example:
192.168.1.200:/mnt/test    /nfsbackup      nfs     hard    0       0

Monday, November 12, 2012

Installing VMware tools on RHEL OEL Centos 6 via yum

# rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub
# rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub


# vi /etc/yum.repos.d/vmware-tools.repo


[vmware-tools]
name=VMware Tools for Red Hat Enterprise Linux $releasever . $basearch
baseurl=http://packages.vmware.com/tools/esx/latest/rhel6/$basearch
enabled=1
gpgcheck=1


Description Packages
VMware Tools with graphics components
vmware-tools-esx-kmods-kernel_type
vmware-tools-esx


VMware Tools without graphics components
vmware-tools-esx-kmods-kernel_type
vmware-tools-esx-nox


yum install vmware-tools-esx-kmods vmware-tools-esx-nox


Reference:VMware Tools Installation Guide For Operating System Specific Packages ESXi 5.1/ ESXi 5.0 VMware Tools

How to Modify HostName RHEL OEL CentOS 6

To modify hostname on RHEL OEL CentOS 6 is simple:

1.To update on fly:

#hostname milliondollarserver.com


2.Write into network config file:

#vi /etc/sysconfig/network


NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=milliondollarserver.com


3.Add new hostname into /etc/hosts file:

# cat /etc/hosts


# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 milliondollarserver.com localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

Friday, November 9, 2012

Customizing WordPress Theme Twenty Eleven Automatic Width

First I don't know any about CSS.

Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

For this reason, it is recommended that you consider creating a child theme for your customisations.

wget http://wordpress.org/extend/themes/download/twentyeleven.1.4.zip
unzip twentyeleven.1.4.zip
mv twentyeleven twentyeleven_child
cd twentyeleven_child/


Modify sytle.css

Change the Theme Name to a different name like : Twenty Eleven Child


/*
Theme Name: Twenty Eleven Child
Theme URI: http://wordpress.org/extend/themes/twentyeleven
Author: the WordPress team
Author URI: http://wordpress.org/


mv twentyeleven_child /www/wordpress/wp-content


Once your child theme is active, we should be able to help with the customisation.

To make your WordPress width fits any resolution Automatic, just common out the [max-width:] line.

/* =Structure
----------------------------------------------- */

body {
padding: 0 2em;
}
#page {
margin: 2em auto;
/* max-width: 1000px;*/
}


Then active the child Theme, and you are done!

Thursday, November 8, 2012

Install PostgreSQL 9.2 on Oracle Enterprise Linux CentOS Redhat 6.3

Disable PostgreSQL 8 packages:

OEL:
# sed -i '7iexclude=postgresql*' /etc/yum.repos.d/public-yum-ol6.repo


CentOS:
# sed -i '19iexclude=postgresql*' /etc/yum.repos.d/CentOS-Base.repo
# sed -i '28iexclude=postgresql*' /etc/yum.repos.d/CentOS-Base.repo


Install PostgreSQL 9.2:

# rpm -ivh http://yum.pgrpms.org/9.2/redhat/rhel-6-x86_64/pgdg-redhat92-9.2-7.noarch.rpm


# yum install postgresql92 postgresql92-libs postgresql92-server


# chkconfig postgresql-9.1 on
# service postgresql-9.1 initdb
# service postgresql-9.2 start

Wednesday, June 2, 2010

Windows Mobile Set SIP Phone

http://www.vsure.org/blog/article.asp?id=113

For example your T-Mobile Dash, T-Mobile Wing GSM Cellular, HTC S630, HTC TyTN II, HP iPAQ, etc. 

The WM6 OS generic version has the ability to be configured to make VOIP calls. But many providers remove this option, not wanting to encourage VOIP use on their network. 

Check if the VoIP is support is present in your ROM, as some cooks have removed them from the ROM. 
so look for the Internet Calling today item as well as for the following files from the packages VoIP and VoIPOS in the Windows directory: 

ipdialplan.xml 
dnsapi.dll 
voipphonecanvas.dll 
rtcdll.dll 

If you don't have Internet Calling support in your ROM download the follow cab and install to your rom. 
http://brujula.net/windows-mobile/wm6voip.cab 
http://brujula.net/windows-mobile/sipconfigtool200.cab 

You can however put it back by installing the WM6 VOIP cab file and then a SIP configuration tool to enable you to enter your own SIP provider. 

http://fonosip.com/english/wm6_smartphone.html 

There is a default dial plan setting in ipdialplan.xml, 
It auto add a '9' when you dial 11 or 10 number. So if you using vbuzzer voip service, it can not call out. 
You can change the dial plan by edit ipdialplan.xml, 

for example: 
 
 
dial='sip:91123@$host$' 
display='1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:91123@$host$' 
display='1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:91123@$host$' 
display='+1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:91123@$host$' 
display='+1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
chang to (just remove the '9') 
 
 
dial='sip:1123@$host$' 
display='1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:1123@$host$' 
display='1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:1123@$host$' 
display='+1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
 
dial='sip:1123@$host$' 
display='+1 (1) 2-3' 
transfer='sip:1123@$host$' 
/> 
**********************************************************************************
and also : 
 
 
dial='sip:9123@$host$' 
display='(1) 2-3' 
transfer='sip:123@$host$' 
/> 
 
dial='sip:9123@$host$' 
display='(1) 2-3' 
transfer='sip:123@$host$' 
/> 

change to (when dial 10 number auto add 1 ) 
 
 
dial='sip:1123@$host$' 
display='(1) 2-3' 
transfer='sip:123@$host$' 
/> 
 
dial='sip:1123@$host$' 
display='(1) 2-3' 
transfer='sip:123@$host$' 
/> 



A guide for configuring and Unlocking your Windows Mobile 6 Smartphone

For example your T-Mobile Dash, T-Mobile Wing GSM Cellular, HTC S630, HTC TyTN II, HP iPAQ, etc.
The WM6 OS generic version has the ability to be configured to make VOIP calls. But many providers remove this option, not wanting to encourage VOIP use on their network.
You can however put it back by installing the WM6 VOIP cab file and then a SIP configuration tool to enable you to enter your own SIP provider.

Fill in the SIP Configurator with the following info:
User: your_sip_number
Password: your_password
SIP Proxy: fonosip.com
Use Outbound Proxy: No
Stun Server: stun.fonosip.com
Once you have everything configured you can make a call, but remember you need to be connected over Wi Fi - you can make calls over 3G if your phone supports it, but to do this you will need to enable it via your SIP Conf Tool by going to Tools > Sip Over 3g/Gsm > Enable Via Reg.

Fring

As an option you can use Fring. It is a gateway program that allows users to make free VoIP phone calls from a Windows Mobile 6 phone.   Fring also allows multiple live chat sessions through Skype, Google Talk, MSN Messenger, and SIP

Fring is unique in that it caters for many different SIP providers  - it's a nice utility and well worth checking out.

Thursday, January 7, 2010

Marvell: Plug Computer - 2w for Mini server


Marvell: Plug Computer 3.0

Based on the Kirkwood Series SoCs, Marvell's SheevaPlug is a plug computer that enables high- performance, always- on, always- connected, and environmentally friendly computing readily available for consumers and developers. A Plug plug Computer computer is designed to draw so such little power that it can be left on all of the time. Unlike other embedded devices in the home, it contains a gigahertz- class processor designed to offer PC- class performance.
Plug Computing computing has been quickly expanding, bringing users new devices, services, and value-added applications, as well as delivering advanced avenues for network connectivity.

By only 2w it will be the perfect product for Home Mini Server.
And it said lower $100.

Only one question, does it has a sata port (both data and power) so I can connect to my WD Green 1.5TB?


Posted using ShareThis