Showing posts with label linux basics. Show all posts
Showing posts with label linux basics. Show all posts

Sunday, January 1, 2012

How USB work in virtualbox (linux)


VirtualBox 4 seems to have the same permission problems described for Linux. If I connect an USB drive, it appears as “unavailable” in VBoxManage or grayed-out in then guest-GUI dropdown mene, no matter what filter I define in the host settings. How can I solve it?
It is a permission problem. For a quick test, start VirtualBox as root. If your USB device is not longer grayed-out, you may have the same problem. Problem could be fixed by adding group permissions to vboxusers in your Linux.
First of all you will need VirtualBox, not VirtualBox Open Source Edition (OSE). The latter version doesn’t support USB devices. And download VirtualBox 4 Oracle VM VirtualBox Extension Pack, its support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.

For Ubuntu
After installing VirtualBox 4 do the following in Ubuntu:
# Go to System -> Administration.
# Scroll down to “Users and Groups”.
# Open Users and Groups
# Click “Manage Groups”.
# When the group settings menu pops up, scroll down to vboxusers. Highlight it. Click “Properties”.
# Check the box beside your user name below the part which says group members. Press OK.
# Reboot.
# Load Virtualbox, and USB should be enabled (when you added on usb device filter, now all devices are now ‘tickable’).
For Fedora
After installing VirtualBox 4 do the following in Fedora:
# Go to System Preferences.
# Scroll down to “Users and Groups”.
# Open Users and Groups
# Click “Groups”
# Click “Add Group”
# When the new group settings pops up, type “vboxusers”. Highlight it. Click “Properties”.
# Check the box beside your user name below the part which says group users. Press OK. (Now you will see that the group members is your user name)
# Reboot.
# Load Virtualbox, and USB should be enabled (when you added on usb device filter, now all devices are now ‘tickable’).

Package Management


Debian based systems (including Ubuntu) uses apt-* commands for managing packages from the command line. Let us review how to use apt-* commands to view, install, remove, or upgrade packages.
APT is acronym for Advanced Package Tool. It supports installing packages over internet (ftp or http). You can also upgrade all packages in single operations, which makes it even more attractive.
Dpkg is Debian packaging tool which can be use to install, query, uninstall packages.

You can also try GUI based or high level interface to the Debian GNU/Linux package system. Such as:
1) aptitude: It is a text-based interface to the Debian GNU/Linux package system.
2) synaptic: GUI front end for APT
Rpm based Linux package names generally end in .rpm similarly Debian package names end in .deb, for example: apache_2.2.14_i386.deb
Install software using apt
$ apt-get install {package-name}
$ apt-get install php
Remove software using apt
$ apt-get remove {package-name}
$ apt-get remove php
Remove/erase package and configuration file
$ apt-get –purge remove {package-name}
$ apt-get –purge remove php
Updating the list of packages in your sources.list
$ apt-get update
Update software using apt
$ apt-get -u upgrade
$ apt-get upgrade php
To change the list of apt mirrors
$ apt-setup
Search for package
$ apt-cache search package
show all installed and removed packages
$ dpkg -l
show install status of package
$ dpkg -l apache
Verify if package sudo is install or not
$ dpkg -l | grep -i ‘apache’
List packages related to the apache:
$ dpkg -l ‘*apache*’

List files owned by the installed package

# dpkg -L apache
What package owns the file
$ dpkg -S {/path/to/file}
$ dpkg -S /bin/netstat
show status of package
$ dpkg -s {package-name}
$ dpkg -s php
show details of package
$ dpkg -p php
list relevant packages
$ apt-cache search “network security”
Find out all denyhosts packages
$ apt-cache search denyhosts
install package from a deb file
$ dpkg -i {filename}.deb
purge package
$ dpkg -P php
re-run the configure for a package
$ dpkg-reconfigure php
get the source
$ apt-get source php
config build-deps for source and install as needed
$ apt-get build-dep
install package from specific release
$ apt-get -t {release} install php
prevent name from running at bootup
$ update-rc.d -f {name} remove
upgrade the distribution
$ apt-get –u dist-upgrade
How to know what packages may be upgraded
apt-show-versions is a program that shows what packages in the system may be updated and several useful information.

Saturday, December 31, 2011

Something about 'chkconfig'


chkconfig provides a simple command-line tool for maintaining the /etc/rc.d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories. Normally chkconfig will be found on Redhat Linux, Fedora and CentOS.
Chkconfig has five distinct functions which is adding new services for management, removing services from management, listing the current startup information for services, changing the startup information for services, and checking the startup state of a particular service.

Below are those examples explains how to use the chkconfig command:
1. View Current Status of Startup Services
The –list option displays all the services with the current startup configuration status.
# chkconfig --list (this will list down all services)
# chkconfig --list | grep network (this will list a service, in above example which is network service only)
2. Add a new Service to the Startup
Use –add option to add a specific service to the list of services that will be started during system reboot.

The following example shows how to add a new service.
# chkconfig --add iptables
# chkconfig --list | grep iptables (to view the new added service)
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off (output)
3. Remove a Service From Startup List
The following example shows that ip6tables services is configured for startup.
To remove it from the startup list, use the –del option as shown below.
# chkconfig --del ip6tables
# chkconfig --list | grep ip6tables (to check removed service)
4. Turn-on or Turn-off a Service
The following example will turn off ip6tables service
# chkconfig ip6tables off
# chkconfig –level 35 ip6tables off (turn off ip6tables for both level 3 and 5)
       
        chkconfig -t|--terse [names]
       chkconfig -s|--set [name state]
       chkconfig -e|--edit [names]
       chkconfig -c|--check name [state]
       chkconfig -l|--list [--deps] [names]
       chkconfig -A|--allservices
       chkconfig -a|--add [names]
       chkconfig -d|--del [names]

Monday, November 14, 2011

Difference between 'su' and 'su -' or 'su root' and 'su -root'


“su” is equivalent to “su root” and “su -” equivalent to “su – root”. “su root” is the default command for “su”. That is, if you type “su” it will assume you mean “su root”. To su to another user you will have to add the users name, such as “su username”. If you use “su” you will still have the same environment, for example the $PATH variable, as the user who su’d. If you use “su”, you will have the environment of the user you su’d to.
The diff between “su” and “su -” is “su -” you log in as a root with the env setting/profile (i.e you really log in as a root). Just type “pwd” and you will be in the root home dir @ /root. if you “su” only then basically you just “borrow” the root permission without having all the root env setting/profile. Just “su” from your home dir and type “pwd”, you can see that you still in the user dir i.e /home/username.
They’re just different paths to get to the same destination. “su” is short for super user. You’ll use it when you’re logged in as a user and wish to do something that requires root privileges. Using “su” or sudo is the only way to access root privileges while logged in as a user unless one wishes to reboot and log in as root. sudo is nothing more than another path to becoming a super user.
Here is a small demo:
A good reason to log in as root would be to set up a user account so you don’t have to log in as root. It’s just to make things easier for a person to run as user instead of root yet provide an easy way to access root when needed.

Thursday, October 13, 2011

How to install xfce


If you have a computer with rather modest specifications (between 128 MB of RAM to 256 MB of RAM), you may find that Kubuntu’s KDE and Ubuntu’s Gnome are too slow on your computer to be functional. There’s another desktop environment called Xfce that is relatively lightweight, and Xubuntu is the version of Ubuntu that comes with Xfce as its default desktop environment.
Xfce is a lightweight desktop environment for unix-like operating systems. It aims to be fast and lightweight, while still being visually appealing and easy to use.Xfce is an easy to use and easy-to-configure environment for X11 based on GTK2. A priority is adherence to standards, specifically those defined at freedesktop.org.

Installing on Ubuntu
$ sudo apt-get install xubuntu-desktop
or
$ sudo apt-get install xfce4 xfce4-goodies
(The Xfce Goodies Project includes additional software and artwork that are related to the Xfce desktop, but not part of the official release. Please note that when installing the Xfce goodies you will install a lot of extra programs you probably don’t need.)
After the installation, you will need to logout or reboot your machine. When you get to the login screen, select the Options button in the lower left hand corner. You will be prompted to select from one of the available window managers. Select Xfce and then login. The Xfce desktop looks a lot like Gnome, but without all the fancy gadgets.
Installing on Fedora
$ yum groupinstall xfce
After installing Xfce you can use the “Session” menu to choose a Xfce login instead of a GNOME or KDE login.