Showing posts with label Linux/Nix. Show all posts
Showing posts with label Linux/Nix. Show all posts

Restore OSX Timemachine backup files in Linux

copy the script from

https://gist.github.com/magicoli/283785bdf21ebafd2202

chmod +x copy-from-time-machine.sh


 ~/Documents/copy-from-time-machine.sh /media/popoy/Seagate/Backups.backupdb/Popoy’s\ MacBook\ Pro/Latest/Macintosh\ HD/Users/popoy/Downloads ~/Documents/Downloads



By penoi on Wednesday, May 25, 2016 | | A comment?

RaspberryPi+raspbian+ratpoison

Setting up a web kiosk system using raspberrypi+raspbian+ratpoison

This instruction assumes that you already installed raspbian on your SD card

Installing required packages

sudo apt-get update
sudo apt-get ratpoison
sudo apt-get chromium
sudo apt-get x11vnc
sudo apt-get install x11-xserver-utils


=====

Start user pi at startup

pi@raspberrypi:~$ grep pi /etc/inittab 
1:2345:respawn:/bin/login -f pi tty1 
/dev/tty1 2>&1

pi@raspberrypi:~$ cat /home/pi/.bash_profile
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startx
fi

=====

Set ratpoison's config file

pi@raspberrypi:~$ cat /home/pi/.xinitrc
exec ratpoison


pi@raspberrypi:~$ cat /home/pi/.ratpoisonrc
banish
exec xset s off
exec xset -dpms
exec unclutter -root
exec x11vnc -loop
exec /usr/bin/chromium --kiosk http://www.penoycentral.net


Remotely connec thru vnc
vncviewer raspberrypi.local

By penoi on Wednesday, November 21, 2012 | | A comment?

Enable DNS queries in BIND

# rndc querylog 


Query logs should be logged on /var/log/messages

To turn off

# rndc querylog


ref: http://www.cyberciti.biz/faq/howto-enable-dns-linux-unix-server-logging/

By penoi on Friday, November 2, 2012 | | A comment?

bash: scp: command not found

scp file.rar root@192.168.11.60:/var/tmp/
root@192.168.11.60's password:
bash: scp: command not found
lost connection


 

i forgot that i have done a minimal server install on the receiving end. installing openssh-clients solve the problem

By penoi on Thursday, November 1, 2012 | , , | A comment?

Vi/VIM

To insert characters on the beginning of a line. Example, insert // from line 1 to 10

 :1,10s!^!//! 


Sample in creating folding in vim. Insert #{{{ text here #}}} provided everything was properly setup on vimrc


~/workspace/puppetworks $ cat site.pp
node 'chrisp.lab.local' {#{{{




}#}}}



pressing zc will close the folded texts


+-- 6 lines: node 'chrisp.lab.local' {#----------------------------------------------------------------------------


ref: http://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

By penoi on Monday, October 1, 2012 | , | A comment?

Mercurial hgwebdir on CentOS 6

Note this setup is unsecured and just for the purpose of having my own lab svn repo.

Install mercurial on your server

yum install mercurial


Setup the mercurial site on apache

mkdir /var/www/cgi-hg
cp /usr/share/doc/mercurial-1.4/hgwebdir.cgi /var/www/cgi-hg/
chmod +x /var/www/cgi-hg/hgwebdir.cgi


Create the hgweb.config
 /var/www/cgi-hg/hgweb.config
[paths]
#VIRTUAL_PATH = /REAL/PATH
#myproject = myproject
lab = /srv/hg


Reload apache
service httpd reload


Make sure everything has the right permission on selinux or you can temporarily disable selinux

Your site now is accessible thru http://servername/hg

To test push functionality,you might try to disable ssl and allow push to all

/srv/hg/.hg/hgrc

[web]
allow_push = *
push_ssl = false



Ref:
http://mercurial.selenic.com/wiki/RHEL4HgWebDirSetup
http://mercurial.selenic.com/wiki/PublishingRepositories

By penoi on Saturday, June 16, 2012 | | A comment?

Quick mail sending test


penoy@fedora:~$ mail -s "test sending mail from nix server" penoy@example.com < /dev/null

By penoi on Friday, June 8, 2012 | | A comment?

Changing Timezone in RHEL/Centos

This is one way of changing your server timezone and resync on the ntp server

 service ntpd stop

 cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime

 ntpdate 

 service ntpd start 


more info: http://www.redhat.com/advice/tips/timezone.html

By penoi on Thursday, May 17, 2012 | | A comment?

remove host key under known_hosts

Normally after a server rebuild you will receive a warning that the host identification has changed

 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.


One solution is to remove the offending host key

ssh-keygen -f "/home/chris/.ssh/known_hosts" -R ip-address-of-the-host

By penoi on Tuesday, May 8, 2012 | | A comment?

RHCSA/RHCE Red Hat Linux Certification Practice Exams with Virtual Machines (Exams EX200 & EX300)

Im a big fan of Michael Jang. Having seen this upcoming book will greatly help all RHCSA/RHCE aspirants. Hopefully Michael can give me a free copy :)

http://www.amazon.com/RHCSA-Certification-Practice-Virtual-Machines/dp/007180160X/ref=sr_1_4?s=books&ie=UTF8&qid=1335154380&sr=1-4


RHCSA RHCE Practice exams

By penoi on Monday, April 23, 2012 | | A comment?

vmnetcfg in VMware Player running in Fedora 16

where is vmnetcfg in VMware Player running in Fedora 16?

It is found under:

/usr/lib/vmware/bin/vmware-netcfg

By penoi on Saturday, April 21, 2012 | | A comment?

Unable to set size of tmpfs in /etc/fstab RHEL6.2

Resized tmpfs space in /etc/fstab to 4g

tmpfs /dev/shm tmpfs size=4096m 0 0

After reboot, size still on 2G
[root@OEL1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel1-lv_root
16G 3.8G 11G 27% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda1 485M 51M 409M 12% /boot


Looks like a bug on RHEL6
https://www.redhat.com/archives/rhelv6-list/2011-February/msg00081.html


[root@OEL1 ~]# mount -o remount /dev/shm
[root@OEL1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel1-lv_root
16G 3.8G 11G 27% /
tmpfs 4.0G 0 4.0G 0% /dev/shm
/dev/sda1 485M 51M 409M 12% /boot
[root@OEL1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)

By penoi on Thursday, March 22, 2012 | | A comment?

OpenWRT Backfire (10.03.1-RC6, r28680) Linksys WRT54GL



My Linksys WRT54GL wireless router running on OpenWRT

By penoi on Saturday, December 17, 2011 | , | A comment?

Laptop overheat in Fedora 16

After installing Fedora 16 on my laptop(or any RH flavors) i noticed a huge temperature difference when running Windows 7 vs Fedora/RH. Definitely, my laptop temperature is high even in idle.

Followed a workaround as discussed in Bugzilla 702953 by setting the GPU power to mid instead of using the max power

[root@fedora ~]# acpi -t
Thermal 0: ok, 78.0 degrees C

Now set the GPU power to mid
[root@fedora ~]# echo mid > /sys/class/drm/card0/device/power_profile

Temperature goes down instantly
[root@fedora ~]# echo `date` && acpi -t
Sun Dec 4 06:18:35 SGT 2011
Thermal 0: ok, 71.0 degrees C
[root@fedora ~]# echo `date` && acpi -t
Sun Dec 4 06:30:05 SGT 2011
Thermal 0: ok, 68.0 degrees C

One alternative way of monitoring temperature is by the use of lm_sensors
[root@fedora ~]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +83.0°C (crit = +103.0°C)

radeon-pci-0100
Adapter: PCI adapter
temp1: +84.0°C


Im running ATI Radeon HD5730 video card

By penoi on Sunday, December 4, 2011 | | A comment?

Red Hat Certified Engineer

It has been a long day for me.. RHCSA exam in the morning and RHCE exam in the afternoon. Finally after months of self study and 4 days on the rapid track course, i nailed both exam.
Pretty much to say that i'm so proud  on the cert. This is not the type of exam that you will just choose among the multiple choice or configure in a simulated environment. It will test your knowledge on how well you understood Redhat.
On future takers, i advised you to know the exam objectives inside and out. SELinux looks like intimidating at first, but as soon as you understand how it works,it will be a piece of cake for you :)

Materials/books used


RHCSA/RHCE Red Hat Linux Certification Study Guide (Exams EX200 & EX300), 6th Edition (Certification Press)  -- Michael Jang
Highly recommend!!! Comes with a CD with pdfs and labs exams at the end of every chapter. My fav source of info for the exam.

Hands-on Guide to the Red Hat® Exams: RHCSA™ and RHCE® Cert Guide and Lab Manual (Certification Guide) -- Damian Tommasino
Lots of errors, but hey, as soon as you pointed the errors in the book, it just shows that you know your stuffs. Used to counter check configs and setup.

RH300 RHCE Rapid Track course
Final review for the exam. It cost much but highly recommended also. It guides me and helps to fill in the gaps on what i have learned already on my home lab. Before taking the course, i advised that you first do your home work. Learn the exam objectives, build your own home lab, simulate the configs as advised on Michael and Damian's book. In this way when you attend the course, you can ask all the questions that you have on your instructor. This is fast-paced course so make full use of it.

texastwister/OpenRHCE - GitHub - This is a beast study guide. I used this as a last minute review before taking the exam. Reading the whole week while in the train :) Highly recommended also

As  always, we signed the Non-disclosure Agreement so i will not divulge anything specific about the exam. I might update this blog,but will not be on the RHCE exam specific anymore.
Study!!! study!!!! study!!!!! lab!!!! lab!!!! lab!!!! simulate!!!! simulate!!!! and always follow the KISS principle..

 

reposted from RHCSA/RHCE Exam notes August 26 2011

By penoi on Tuesday, September 6, 2011 | | A comment?

Scientific Linux 6 released

Scientific Linux 6 was released for i386 and x86_64

By penoi on Friday, March 4, 2011 | | A comment?

Playing with Logical Volume Manager

Initialize disk using pvcreate

[root@rhel01 ~]# pvcreate /dev/sda1
Physical volume "/dev/sda1" successfully created

Create volume group lab_group1
[root@rhel01 ~]# vgcreate lab_group1 /dev/sda1
Volume group "lab_group1" successfully created

In this sample i created 10MB of logical volume mount to /mnt
[root@rhel01 ~]# lvcreate -L 10M lab_group1 -n lab01
Rounding up size to full physical extent 12.00 MiB
Logical volume "lab01" created
[root@rhel01 ~]# mkfs.ext4 /dev/lab_group1/lab01
mke2fs 1.41.12 (17-May-2010)

[root@rhel01 ~]# mount /dev/lab_group1/lab01 /mnt
[root@rhel01 ~]# df -h /mnt

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/lab_group1-lab01

12M  1.2M   10M  11% /mnt

Extending Logical Volume using new disk

Initialize new disk
[root@rhel01 ~]# pvcreate /dev/sdb1
Wiping software RAID md superblock on /dev/sdb1
Physical volume "/dev/sdb1" successfully created

Extend lab_group1 volume group
[root@rhel01 ~]# vgextend lab_group1 /dev/sdb1
Volume group "lab_group1" successfully extended
[root@rhel01 ~]# vgdisplay lab_group1
--- Volume group ---
VG Name               lab_group1
System ID
Format                lvm2
Metadata Areas        2
Metadata Sequence No  3
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               0
Max PV                0
Cur PV                2
Act PV                2
VG Size               56.00 MiB
PE Size               4.00 MiB
Total PE              14
Alloc PE / Size       3 / 12.00 MiB
Free  PE / Size       11 / 44.00 MiB
VG UUID               o8kB09-P20F-QLFx-UmPE-5BB5-mlu9-o867qV

Extend logical volume lab01
[root@rhel01 ~]# lvextend -L +10M /dev/lab_group1/lab01
Rounding up size to full physical extent 12.00 MiB
Extending logical volume lab01 to 24.00 MiB
Logical volume lab01 successfully resized
[root@rhel01 ~]# df -h /mnt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/lab_group1-lab01
12M  1.2M   10M  11% /mnt
[root@rhel01 ~]# resize2fs /dev/lab_group1/lab01
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/lab_group1/lab01 is mounted on /mnt; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/lab_group1/lab01 to 24576 (1k) blocks.
The filesystem on /dev/lab_group1/lab01 is now 24576 blocks long.
[root@rhel01 ~]# df -h /mnt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/lab_group1-lab01
24M  1.2M   22M   5% /mnt

By penoi on Friday, February 18, 2011 | | A comment?

LVM: Can't remove open logical volume



lvremove command can't remove open logical volume



[root@rhel01 /]# lvremove /dev/lab_group/lab01

Can't remove open logical volume "lab01"

Command failed


Using dmsetup command to check the status of the LVM



[root@rhel01 /]# dmsetup info -c lab_group-lab01

Name             Maj Min Stat Open Targ Event  UUID

lab_group-lab01  253   7 L--w    0    1      0 LVM-XHpst6rC31EOIHxjWAp6CfbCBUIcF                                                                        p1uqjWa6RINr32OZVWF0pdnfaal8DKoUZGH


Eventhough Open is 0 still can't remove the logical volume




[root@rhel01 /]# lvremove /dev/lab_group/lab01

Can't remove open logical volume "lab01"



Removing dm table entry



[root@rhel01 /]# dmsetup remove lab_group-lab01


lvremove successfully removed the logical volume



[root@rhel01 /]# lvremove /dev/lab_group/lab01

Logical volume "lab01" successfully removed




By penoi | | A comment?

Oracle Certified Sytem Admin for Solaris 10

Passing score:63

Your Score : 70

Result: PASS

Whoa i barely passed  Oracle Certified System Admin for Solaris 10 (310-202) Part 2 exam. Caught off guard on LDAP and I just hate Jumpstart questions. Already convinced myself that  i failed the exam because of the low percentile per topic, but what a relief when the examiner handed me the test printout with the word PASS.

Have to relax first this weekend before i go back to my labs.. hopefully RHCE eh :)

By penoi on Friday, February 11, 2011 | | A comment?

/sbin/loader hangs while installing RHEL 6 in Virtualbox

running install...

running /sbin/loader

Hit tab key in Grub and enter this at the end of the line
linux apm=off acpi=off pci=noacpi

Referrence http://www.samlesher.com/category/fedora

By penoi on Saturday, January 22, 2011 | | A comment?