Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Tuesday, June 10, 2014

Bash script to adjust laptop LCD backlight

##!/bin/bash

export blval=`sudo intel_backlight |awk '{print $4}' |sed 's/%//g'`
if  test "$1" = "up"
then
        echo "currrent val : $blval"
        export blval=`expr $blval + 10`
        echo "increase to $blval"
elif test "$1" = "down"
then
        echo "currrent val : $blval"
        export blval=`expr $blval - 10`
        echo "decrease to $blval"


else
        echo  "e.g adj_backlight.sh [ up | down ]"
fi

sudo intel_backlight $blval
exit

Sunday, September 22, 2013

Ubuntu slow connection with Atheros AR9485

Took the latest snapshot from https://www.kernel.org/pub/linux/kernel/projects/backports/  ran make defconfig-ath9k && make && sudo make install. Hopefully the patches will get in soon enough, so that I don't need to rerun the module building every time kernel updates.


[src: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/971809/comments/63]

Wednesday, April 24, 2013

Ubuntu Relaying Postfix SMTP (gmail)


The purpose is to sent mail through my Linux laptop with mailutils...

1. # apt-get install postfix

2. Edit /etc/postfix/main.cf by edit any exist entry as below values:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

3. Saved your gmail authentication info to  /etc/postfix/sasl_passwd  as below:
[smtp.gmail.com]:587    user.name@gmail.com:password

4. Change permissions 
#sudo chmod 400 /etc/postfix/sasl_passwd
#sudo postmap /etc/postfix/sasl_passwd

5. Tell it where it can validate the certificate.
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

6. Restart & Test
#sudo service postfix restart
# echo 'test' | mail user.name@gmail.com

end.

[ref :https://help.ubuntu.com/community/Postfix]

Friday, April 5, 2013

Enable flash player for Chromium on Ubuntu


    1  sudo apt-get install flashplugin-nonfree
    2  sudo cp /usr/lib/flashplugin-installer/libflashplayer.so /usr/lib/chromium-browser/plugins
    3  chromium-browser --enable-plugins

Tuesday, November 20, 2012

Compile Kernel on Ubuntu 12.04



1. Downloading latest stable source code from http://www.kernel.org/.



2. While downloading, we install necessary packages required to compile the kernel.
# apt-get install kernel-package libncurses5-dev fakeroot wget bzip2


3. Untar the source code.

# mv ~/Downloads/linux-3.6.7.tar.bz2  /usr/src/
# cd /usr/src
# tar -jxvf linux-3.6.7.tar.bz2
# ln -s linux-3.6.7 linux
# cd linux




4. Configure the kernel
# cp /boot/config-3.2.0-33-generic ./.config
# make menuconfig

Screen below should show up, pick 'Loan an Alternate Configuration File' as '.config', then pick 'OK' follow by 'EXIT'





5. Start building....
# make-kpkg clean
# fakeroot make-kpkg  --initrd --append-to-version=-mykernel kernel_image kernel_header  -j4

'mykernel' can change to anything you like, option -j4 is to tell make use up to 4 threads.
Now walk away from your PC go enjoy coffee.



Finally completed. 


6. Installing...
# cd ..
$ sudo dpkg -i linux-image-3.6.7-mykernel_3.6.7-mykernel-10.00.Custom_amd64.deb
$ sudo dpkg -i linux-headers-3.6.7-mykernel_3.6.7-mykernel-10.00.Custom_amd64.deb 




# sudo shutdown -r 0


Monday, October 29, 2012

Script to on/off touchpad on Ubuntu 12.04

I wrote this is for workaround for those touchpad button & fn key is not working.


1 )  Create file ~/tp.sh with content below.

#!/bin/bash


off=`sudo synclient |grep TouchpadOff |cut -c30-35`

if [ $off -eq 0 ] ;then
echo 'turnoff touchpad';
sudo synclient TouchpadOff=1
else
echo 'turnon touchpad';
sudo synclient TouchpadOff=0
fi


2 ) sudo chmod +x ~/tp.sh

3 ) Adding shortcut by launch Settings > Keyboard, go to tab 'Shorcuts'
 Click '+' icon for adding new shortcut.
Name: Touchpad On/Off
Shortcut: sudo ~/tp.sh
 
Click 'Apply', then click on Disable to select shortcut key, my case is Super+f9 since Fn will not work here.

4 ) Grant permission
adding line below to sudoer and replace <user> to your username.
<user> ALL = (ALL) NOPASSWD: /home/<user>/tp.sh

Enjoy!

Friday, October 19, 2012

Install JDK6 on Ubuntu 12.04

1. Download binary file from http://www.oracle.com/technetwork/java/javase/downloads/jdk6u37-downloads-1859587.html

jdk-6u37-linux-x64.bin


2. Switch to root.
$ sudo -s

3. Move the file to JVM dir.
# cd /usr/lib/jvm/
# mv ~/Downloads/jdk-6u37-linux-x64.bin ./
# sh jdk-6u37-linux-x64.bin

4. Dir jdk1.6.0_37 is extracted, now install using update-alternatives
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_37/bin/java 1000
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_37/bin/javac 1000
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_37/bin/javaws 1000

5. #update-alternatives --config java
Choose the option that you just installed.

6. Verify.
# java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)


Wednesday, October 17, 2012

svnjavahl not found ubuntu 12.04

In version 12.04, lib path for native lib is changed to /usr/lib/x86_64-linux-gnu/jni,

I'set "-Djava.library.path=/usr/lib/x86_64-linux-gnu/jni" (on 64 bit installation) in eclipse.ini

Saturday, September 22, 2012

Adding VHost to apache2 (Ubuntu 12.04)

Following steps is not include installation of apache2.

1. Create vhost dir.
sudo mkdir /etc/var/www/example.com/public_html


2. I use for development, so I map the localhost IP to example.com, if you using internet IP, go to next step.

sudo nano /etc/hosts

#add line
127.0.0.1 example.com


3. Grant permissions to 'www/example.com/public_html'

sudo chown www-data:www-data /var/www/example.com/public_html -R

sudo chmod 755 -R /var/www/example.com


4. Creating Vhost file.

cd /etc/apache2/sites-available
cat default > example.com
nano example.com


#add line after ' ServerAdmin webmaster@localhost'
ServerName    example.com
DocumentRoot   /var/www/example.com/public_html

#correct the <Directory> tag with correct attribute.
 <Directory /var/www/example.com/public_html/>


5. Enable the site.

a2ensite example.com
services apache reload


6. Test the site by browser the example.com.




Thursday, September 20, 2012

Installing Ubuntu 12.04 to Toshiba Z930

Just got my new Ultrabook from shop, Toshiba Z930 come with :


  • i5-3317U
  • 6GB DDR3 
  • 128 GB SSD
  • 13.3" LCD with IntelHD Graphic


This laptop planed to use as working purpose, so will swipe off the window partition and replace with Ubuntu 12.04 LTS. I'm going to show how to backup the pre-load window and Install a fresh Ubuntu as below.

Window license is not cheap, so we backup it in-case we need it in future time. To backup the hold partition by cmd below with Ubuntu livecd (usb).

    dd if=/dev/sda |gzip -9 | of=/media/usbdisk/sda.img.gz

'media/usbdisk' is path for USB drive, next is launched the installer.


.
1. SELECT LANGUAGE


2. LEAVE EVERYTHING UNCHECK & CONTINUE


3. ERASE THE DISK AND INSTALL

4. SELECT LOCATION


5. LEAVE IT DEFAULT & CONTINUE


6. ACCOUNT, IF YOU HAVE SENSITIVE DATA, CHECK THE 'ENCRYPT MY HOME FOLDER


7. BOIL WATER & COFFEE 


8. RESTART


After installation, some tweaking need to done, follow the instructions from gaggl.com.

What is not working :

  1. Touchpad on/off button
  2. Eco mode button
  3. Fingerprint sensor (did re-compile aes1610 driver with 1660 device id but not compatible, hopefully vendor add the driver for aes1660 soon)







[img src] http://www.vxbus.com/software/linux/143-how-to-install-ubuntu-1204-from-usb-drive.html