Showing posts with label Linux Tips. Show all posts
Showing posts with label Linux Tips. Show all posts

Tuesday, June 5, 2012

Linux Ubuntu 12.04 - Ati / AMD discrete graphics

After searching "A LOT" on the web, forums, etc... i found a page that has a tip that works to change linux xserver to discrete graphics.

http://thealarmclocksixam.wordpress.com/2012/03/23/ubuntu-12-04-and-hybrid-graphics-on-sony-vaio-s/

I used this on my laptop HP dv6

Here are the steps;
1. edit /etc/modprobe.d/blacklist.conf
 
2. add these 2 lines to the end of the file 
# radeon
blacklist radeon
 
3. edit /etc/rc.local
modprobe radeon
chown -R $USER:$USER /sys/kernel/debug
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
 
4. reboot and it should be good
 
5. you can check if it worked
cat /sys/kernel/debug/vgaswitcheroo/switch
 
no more fan's noise, no more temperature...
Very nice hack
 
:D

Monday, July 18, 2011

Linux - Ubuntu - 2 Media tips

Two quick Linux media tips:

- Webcam - Viewer / recorder
To use my webcam i found this great peace of software:
"GUVCView"

To install it on ubuntu (simply):
# apt-get install guvcview

And that's it, you can launch it and view / record or take snapshots with your webcam.

- ffmpeg - great tool to encode and transform your videos, avi, mpeg, mov...etc.
# apt-get install ffmpeg
and use it:
$ ffmpeg -formats
$ ffmpeg -i yourfile.ext -vcodec wmv2 -sameq -acodec wmav2 -f avi outfile.avi

I run into some trouble with the xvid codecs, but found the solution here:
https://wiki.ubuntu.com/ffmpeg


That's it.

Tuesday, June 29, 2010

Linux - Tools to view disk activity

Here are some tools to find out what process is "eating" your resources:

  • iotop
  • vmstat
  • lsof
  • atop
  • strace -e trace=open "aplication"

.

Friday, June 25, 2010

HAproxy - LoadBalancer - Simple config

I'm testing HAproxy, here is my first simple configuration:
- 1 haproxy server -> Serving 2 backend webservers

Request ---> haproxy:80  ---refered as "webfarm"
                 |          
                / \
            moss1  moss2

Config file: haproxy.cfg

global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log loghost    local0 info
        maxconn 4096
        #nbproc 2
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen  webfarm 0.0.0.0:80
        cookie  SERVERID insert indirect nocache
        balance roundrobin
        server  moss1 10.30.1.61:80 cookie check inter 2000 rise 2 fall 5
        server  moss2 10.30.1.62:80 cookie check inter 2000 rise 2 fall 5

listen admin_stats 0.0.0.0:81
        mode http
        stats uri       /my_stats
        stats realm     Global\ statistics
        stats auth      username:password

        #errorloc       502     http://192.168.114.58/error502.html
        #errorfile      503     /etc/haproxy/errors/503.http
        errorfile       400     /etc/haproxy/errors/400.http
        errorfile       403     /etc/haproxy/errors/403.http
        errorfile       408     /etc/haproxy/errors/408.http
        errorfile       500     /etc/haproxy/errors/500.http
        errorfile       502     /etc/haproxy/errors/502.http
        errorfile       503     /etc/haproxy/errors/503.http
        errorfile       504     /etc/haproxy/errors/504.http


To access haproxy stats:
http://webfarm:81/my_stats

It's working nice, i have to continue tests and try more configuration settings.

.

Wednesday, June 2, 2010

Ubuntu 10.04 - tips - boot in graphic mode

I'm trying Ubuntu (finaly...i wasn't a big fan...but it's growing :)

I installed Lucid Lynx, desktop version, but i'm using it as my second workstation, so i wanted to "tweak it" a little bit.

To boot in text mode, i did some search and found that Ubuntu desktop is configured to work in graphic mode in almost every runlevel

So we can config grub to boot in text mode:
edit /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

add "text"
to the options.

And i also stopped some services:
/etc/rc2.d/
# mv S70bluetooth K70bluetooth

I must confess that the package management of debian based systems is the best (in my humble opinion)

I'm very impressed with "apt-get" ;)
.

Tuesday, March 2, 2010

Problem with Squid - signal 6

Squid-cache on a linux machine, was crashing repeatedly with the error:
$ exited due to signal 6

After lots of logs reading and net hunting i found out that this error was corrected on a newer version of squid.

The error was on the following version:
Squid Cache: Version 2.5.STABLE6

I upgraded to:
Squid Cache: Version 2.5.STABLE11
So i upgraded and .... no more crashes.

Some tips and commands that helped on troubleshooting:
Read squid logs:
 - /var/log/squid
     - cache.log


Verify squid cache directory:
- /var/spool/squid

Verify message logging:
 - /var/log/messages

Commands:
to rebuild cache:  squid -z

to start with debug: squid -d 3 -F -N -X
-d 3  --- more debug level
-F     --- don't service any request until cache is rebuild
-N    --- no daemon level
-X     --- force full debug 





Tuesday, October 13, 2009

Compile - NginX under Linux

== Tips for compiling NginX ==

After downloading nginx tarball you also need:
- zlib.tar.gz
- openssl.tar.gz


1 - make and install zlib
2 - uncompress openssl tarball
3 - Configure nginx script:
   - ./configure \
      --with-http_ssl_module --with-openssl=../openssl-uncompress-dir \
      --prefix=/srv/your-dir
4 - make
5 - make install



 That should give a working nginX server ;)


Thursday, September 10, 2009

Linux - diags commands, Get hard / soft Info

Here are some commands that we can use to obtain info from a Linux host:


# dmesg              -- show bootup messages / detected hardware

top                -- show cpu/mem/swap usage and running processes
# mii-tool           -- show nic infos
# du -xh | sort      -- show disk usage

# ps -exfcl          -- show processes running - list 
# rpm -qa            -- show packages.version installed - (redhat/fedora)
# cat /etc/fstab     -- show filesystem table

# cat /proc/cpuinfo  -- show cpu information
# cat /proc/devices  -- show devices ( /proc "filesystem" shows lots of info)
# cat /proc/meminfo  -- show memory


The list continues...i will add some more later

Thursday, December 18, 2008

Linux - Find BIG files

A little tip for linux:

To find large files on a system we can do:

$ find / -type f -size +20000k -exec ls -lh {} \;

We can use other filesystem like /home or /tmp

Wednesday, May 14, 2008

Linux Tip - Burn cd's

-- Create an .iso:

#umount /dev/cdrom
#dd if=/dev/cdrom of=filename.iso bs=1024


-- Create .iso image file form a "dir":

#mkisofs -r -J -o file.iso /location_of_folder/
-r generates Rock Ridge long names for Linux
-J generates Joliet long names for Windows

-- Mount .iso file without having to burn:
#mkdir /media/iso
#modprobe loop
#mount cdrom.iso /media/iso/ -t iso9660 -o loop

-- To "burn" an .iso to cd:

#cdrecord dev=/dev/cdrom driveropts=burnfree -v -data cd_image.iso

To burn an audio cd from wav files:

#cdrecord dev=/dev/cdrom driveropts=burnfree -v -audio [wav files...]

Replace /dev/cdrom as needed if this is not your CD-Writer

-v (verbose) lets you track the recording progress

driveropts=burnfree helps reduce the risk of a buffer under-run (most drives should support this)

Tuesday, January 15, 2008

Linux Tip - Get back GRUB after clone

After cloning a Linux HDD, i've booted from the new hdd and got myself a "pretty" grub error, the screen just went:
GRUB GRUB GRUB GRUB

and it filed my screen with that.

How to recover the mbr? here is the solution that i have found on the net (google it...)

1. Boot with any live CD (I've done it with Knoppix 3.x and Ubuntu)
2. Get a root shell and make a folder (mkdir ubuntu)
3. mount the root (/) partition of ubuntu (e.g. mount /dev/hdb ubuntu if you have two disks)
4. chroot the mounted partition (chroot ubuntu)
5. grub-install /dev/hda [1]
5. Exit the shell
6. Reboot

That did the trick :)

Thursday, January 3, 2008

Linux Tip - no Beeps on console

To remove the beeps on the console, we can do this:

# setterm -blen 0

Then we can put this line on /etc/rc.d/init.d/rc.local

every time your Linux box boot it will read the above line and
this will end the beeps on linux console.

Linux Tip - Keymap

To change console keymap in debian:

# dpkg-reconfigure console-tools

if that doesn't work, perhaps:

# apt-get install console-data console-tools debconf

and
# apt-get update