Home | Posts RSS | Comments RSS | Login

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

Install XAMPP on Ubuntu

Thursday, July 8, 2010
How to obtain the latest version of LAMP on Ubuntu:
(Apache 2.2 + MySQL 5.1 + PHP 5.2 + PERL 5.10 +PEAR + SQLite + ProFTPD + phpMyAdmin + Webalizer + phpSQLiteAdmin + XAMPP Control Panel)
http://www.ubuntuforums.org/223410
http://www.apachefriends.org/f/viewtopic.php?t=21531#108517
The commands in this HOWTO must be entered in the terminal:
Applications -> Accessories -> Terminal
Download XAMPP to your desktop and extract the files:
http://apachefriends.org/xampp-linux
cd ~/Desktop
wget http://www.apachefriends.org/download.php?xampp-linux-1.7.1.tar.gz
sudo tar xvfz xampp-linux*.tar.gz -C /opt

Create a XAMPP start menu entry:
cd ~/.local/share/applications
gedit xampp-control-panel.desktop

Paste the following into the open file:



[Desktop Entry]
Comment=Start/Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo /opt/lampp/share/xampp-control-panel/xampp-control-panel
Icon[en_CA]=/opt/lampp/htdocs/xampp/img/logo-small.gif
Encoding=UTF-8
Terminal=false
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start/Stop XAMPP
Type=Application
Icon=/opt/lampp/htdocs/xampp/img/logo-small.gif

Save and close the file.
Publish:
XAMPP uses /opt/lampp/htdocs as the root web directory, but you can publish pages in your home directory this way.
cd ~
mkdir public_html
sudo ln -s ~/public_html /opt/lampp/htdocs/$USER

Now any files and folders you place in ~/public_html will be
published to your personal webserver.
Start XAMPP via the terminal:
cd /opt/lampp
sudo ./lampp start

Stop XAMPP (if necessary):
cd /opt/lampp
sudo ./lampp stop

Via the XAMPP Control Panel:
Applications -> Other -> XAMPP Control Panel
If Apache2 or MySQL is already running, then XAMPP will not start. You must stop these applications, if you want to use XAMPP:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop

PHP5 is the default, but you can switch between PHP4 and PHP5, if you like:
cd /opt/lampp
sudo ./lampp php4
sudo ./lampp php5

Open your new webpages at:
http://localhost/username/
Security:
http://apachefriends.org/xampp-linux/381
1. The MySQL root user has a blank password.
2. MySQL is accessible via your local network.
3. ProFTPD has user “nobody” with password “lampp”.
4. PhpMyAdmin is accessible via the local network.
5. Examples are accessible via the local network.
6. MySQL and Apache running under the same user “nobody”.
To configure some of the security features of xampp:
cd /opt/lampp
sudo ./lampp security

how to improve your CORE 2 DUO processors in Ubuntu

Monday, March 1, 2010

Changing the default 'generic' kernel to 'server' kernel

If you install Ubuntu from the live cd or alternate install cd, the 'generic' kernel would be installed by default. The 'generic' kernel focuses on i586 and i686 CPU architectures. But if you have a newer CPU, like Pentium 4 HT, Dual Core or Core2Duo, you might want to install the 'server' kernel to improve your PC performance. The 'server' kernel focuses on i686 architectures and posses some unique advantages over 'generic' kernel in case of task management.

Note that you should not change the default kernel if you don't have a CPU that belong in the families stated above. And also be aware of the fact that kernel changing might cause big problems in your computer [such as making the system unstable!].

Here is the complete walkthrough of changing your kernel:

1. Disable any proprietory video card driver that you are using. You must do this, otherwise your computer could not start X after enabling the new kernel.

2. Open Synaptic package manager and select the following packages for installation
  • linux-server
  • linux-headers-2.6.24-17-server
  • linux-headers-server
  • linux-image-2.6.24-17-server
  • linux-image-server
  • linux-restricted-modules-2.6.24-17-server
  • linux-restricted-modules-server
  • linux-ubuntu-modules-2.6.24-17-server
3. Now install these packages by clicking 'Apply'

4. Restart your computer upon completation of download and installation

5. From System > Administration > Hardware Driver menu, enable the proprietory video card driver that you have disabled previously. You might have to restart your PC again.

6. Its all done. You can check your kernel version by typing 'uname -r' in the terminal.

You might want to uninstall the old generic kernel packages to free up your hard drive space. In that case, open Synaptic package manager and mark these packages for complete removal:

  • linux-generic
  • linux-headers-2.6.24-17-generic
  • linux-headers-generic
  • linux-image-2.6.24-17-generic
  • linux-image-generic
  • linux-restricted-modules-2.6.24-17-generic
  • linux-restricted-modules-generic
  • linux-ubuntu-modules-2.6.24-17-generic
After uninstalling these packages, restart your computer. Now you won't see option for 'generic' kernel boot in the GRUB.

[WIKI] linux swap.

Thursday, December 3, 2009


Linux divides its physical RAM (radom access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.
Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.
However, swapping does have a downside. Compared to memory, disks are very slow. Memory speeds can be measured in nanoseconds, while disks are measured in milliseconds, so accessing the disk can be tens of thousands times slower than accessing physical memory. The more swapping that occurs, the slower your system will be. Sometimes excessive swapping or thrashing occurs where a page is swapped out and then very soon swapped in and then swapped out again and so on. In such situations the system is struggling to find free memory and keep applications running at the same time. In this case only adding more RAM will help.
Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.
To see what swap space you have, use the command swapon -s. The output will look something like this:


Filename  Type       Size       Used Priority
/dev/sda5 partition  859436  0       -1
 
Each line lists a separate swap space being used by the system. Here, the 'Type' field indicates that this swap space is a partition rather than a file, and from 'Filename' we see that it is on the disk sda5. The 'Size' is listed in kilobytes, and the 'Used' field tells us how many kilobytes of swap space has been used (in this case none). 'Priority' tells Linux which swap space to use first. One great thing about the Linux swapping subsystem is that if you mount two (or more) swap spaces (preferably on two different devices) with the same priority, Linux will interleave its swapping activity between them, which can greatly increase swapping performance.
To add an extra swap partition to your system, you first need to prepare it. Step one is to ensure that the partition is marked as a swap partition and step two is to make the swap filesystem. To check that the partition is marked for swap, run as root:


fdisk -l /dev/hdb
 
Replace /dev/hdb with the device of the hard disk on your system with the swap partition on it. You should see output that looks like this:


Device Boot    Start      End           Blocks  Id      System
/dev/hdb1       2328    2434    859446  82      Linux swap / Solaris
 
If the partition isn't marked as swap you will need to alter it by running fdisk and using the 't' menu option. Be careful when working with partitions -- you don't want to delete important partitions by mistake or change the id of your system partition to swap by mistake. All data on a swap partition will be lost, so double-check every change you make. Also note that Solaris uses the same ID as Linux swap space for its partitions, so be careful not to kill your Solaris partitions by mistake.
Once a partition is marked as swap, you need to prepare it using the mkswap (make swap) command as root:


mkswap /dev/hdb1
 
If you see no errors, your swap space is ready to use. To activate it immediately, type:


swapon /dev/hdb1
 
You can verify that it is being used by running swapon -s. To mount the swap space automatically at boot time, you must add an entry to the /etc/fstab file, which contains a list of filesystems and swap spaces that need to be mounted at boot up. The format of each line is:
Since swap space is a special type of filesystem, many of these parameters aren't applicable. For swap space, add:


/dev/hdb1       none    swap    sw      0       0
 
where /dev/hdb1 is the swap partition. It doesn't have a specific mount point, hence none. It is of type swap with options of sw, and the last two parameters aren't used so they are entered as 0.
To check that your swap space is being automatically mounted without having to reboot, you can run the swapoff -a command (which turns off all swap spaces) and then swapon -a (which mounts all swap spaces listed in the /etc/fstab file) and then check it with swapon -s.

Swap file

As well as the swap partition, Linux also supports a swap file that you can create, prepare, and mount in a fashion similar to that of a swap partition. The advantage of swap files is that you don't need to find an empty partition or repartition a disk to add additional swap space.
To create a swap file, use the dd command to create an empty file. To create a 1GB file, type:


dd if=/dev/zero of=/swapfile bs=1024 count=1048576
 
/swapfile is the name of the swap file, and the count of 1048576 is the size in kilobytes (i.e. 1GB).
Prepare the swap file using mkswap just as you would a partition, but this time use the name of the swap file:


mkswap /swapfile
 
And similarly, mount it using the swapon command: swapon /swapfile.
The /etc/fstab entry for a swap file would look like this:


/swapfile       none    swap    sw      0       0

How big should my swap space be?

It is possible to run a Linux system without a swap space, and the system will run well if you have a large amount of memory -- but if you run out of physical memory then the system will crash, as it has nothing else it can do, so it is advisable to have a swap space, especially since disk space is relatively cheap.
The key question is how much? Older versions of Unix-type operating systems (such as Sun OS and Ultrix) demanded a swap space of two to three times that of physical memory. Modern implementations (such as Linux) don't require that much, but they can use it if you configure it. A rule of thumb is as follows: 1) for a desktop system, use a swap space of double system memory, as it will allow you to run a large number of applications (many of which may will be idle and easily swapped), making more RAM available for the active applications; 2) for a server, have a smaller amount of swap available (say half of physical memory) so that you have some flexibility for swapping when needed, but monitor the amount of swap space used and upgrade your RAM if necessary; 3) for older desktop machines (with say only 128MB), use as much swap space as you can spare, even up to 1GB.
The Linux 2.6 kernel added a new kernel parameter called swappiness to let administrators tweak the way Linux swaps. It is a number from 0 to 100. In essence, higher values lead to more pages being swapped, and lower values lead to more applications being kept in memory, even if they are idle. Kernel maintainer Andrew Morton has said that he runs his desktop machines with a swappiness of 100, stating that "My point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don't want hundreds of megabytes of BloatyApp's untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful."
One downside to Morton's idea is that if memory is swapped out too quickly then application response time drops, because when the application's window is clicked the system has to swap the application back into memory, which will make it feel slow.
The default value for swappiness is 60. You can alter it temporarily (until you next reboot) by typing as root:


echo 50 > /proc/sys/vm/swappiness
 
If you want to alter it permanently then you need to change the vm.swappiness parameter in the /etc/sysctl.conf file.

Conclusion

Managing swap space is an essential aspect of system administration. With good planning and proper use swapping can provide many benefits. Don't be afraid to experiment, and always monitor your system to ensure you are getting the results you need.

How to switch to ROOT users in Ubuntu

Saturday, November 21, 2009
if you have used debian before, you should know that there is a "su" command allowing you to get ROOT permission.
unfortunately, in ubuntu, it seems that they have banned the root login. so knowing you didn't set a password for root user, you still have no way to get in as a root user.

there are nifty ways to accomplish that.

1) there is a root terminal, go to the manu bar =>applications=>system tools=>root terminal.  use your password to get into it.

2) use the normal terminal, type in "sudo su" to switch to ROOT user.


ubuntu 9.10 problems so far

ubuntu has been out there for a while and i upgraded it one week ago. it seems not that stable so far. system has crashed couple times and it always freezes. i have to run the tty1 and  manually kill -9 the application seem to cause the problem. still unclear what the reasons are.


the freeze is seen as the screen or the application specifically dimmed in lightness


went to Ubuntu forum, got something like this below.


Ubuntu 9.10  freezes

Quote:
Originally Posted by MG37221 View Post
I'm having it. About once a day. Firefox is always in use when this happens. I've no clue but only my reset button can unfreeze it (cold boot). Been on Ubuntu since 7.04 and used SuSE prior. Am actively looking for patches to make 9.10 as stable as all previous versions. This one has not been trouble free as I've gotten used to although I am aware of the vast complexities involved with an update to an entire operating system! Mine has been a clean install.
+1

Although my system crashes (reboots) as well as freezes, and it does so far more often than once a day and not always when Firefox is running.

It's the worst issue I've ever had to deal with in Linux.
michaelzap is online now