Archive

Articles taggués ‘administration’

Clone Your Ubuntu installation

09/03/2024 Comments off

If you want to create a system that is similar to a different system you have already set up, it can be difficult to remember each and every package you had installed.This method works best when you are exporting to and importing from the same distribution and, specifically, the same releasefor example, exporting from Ubuntu Dapper to Ubuntu Dapper or ubuntu edgy to ubuntu edgy.

Ubuntu uses the APT package management system which handles installed packages and their dependencies. If we can get a list of currently installed packages you can very easily duplicate exactly what you have installed now on your new machine. Below is a command you can use to export a list of your installed packages.

sudo dpkg --get-selections | grep '[[:space:]]install$='| awk '{print $1}' > installedpackages
Now you should end up with a file called “installedpackages” which consists of a long list of every package your currently have installed.

The next step would be to tell the clone machine to install each of those packages. You’ll have to copy that file to the clone machine (via network, usb drive, email, etc) and also make sure to duplicate the /etc/apt/sources.list file. Without the same access to repositories it may not be able to find the packages.

To tell your system to use the previously exported package list use the following command (after making sure to also clone your /etc/apt/sources.list file).

Update the source list using the following command

sudo aptitude update

Import the package list using the following command

cat installedpackages | xargs sudo aptitude install

 

How to list all installed packages?

01/03/2024 Comments off

To get a list of packages installed locally do this in your terminal:

dpkg --get-selections | grep -v deinstall

To save that list to a text file called packages on your desktop do this in your terminal:

dpkg --get-selections | grep -v deinstall > ~/Desktop/packages

Quick Reference Guide For Linux Commands

27/02/2024 Comments off

Linux command shelf is a quick reference guide for all linux user who wish to learn linux commands. Commands are divided into 15 categories , which would be more easier to understand what commands to be used in specific requirement. The pdf format of linux command shelf is also available. You could reach Bobbin Zachariah the author of this guide for any comments or corrections.

You can download the latest version of linux command shelf in pdf format. Current linux command shelf version is 1.1. This guide can be used by both advanaced and new linux users , provided the best efforts to give most relevant linux commands.

You can navigate to each section using the index that is places on the right hand side of this page or just below. If you feel hard to understand any command please let me know on my above profile page.

1. SYSTEM

# uname –a                       # Display linux system information
# uname –r                       # Display kernel release information
# cat /etc/redhat_release        # Show which version of redhat installed
# uptime                         # Show how long the system has been running + load
# hostname                       # Show system host name
# hostname -i                    # Display the IP address of the host
# last reboot                    # Show system reboot history
# date                           # Show the current date and time
# cal                            # Show this month calendar
# w                              # Display who is online
# whoami                         # Who you are logged in as
# finger user                    # Display information about user
Categories: Système Tags: ,

Interdisez l’accès à votre serveur web par pays

26/02/2024 Comments off

Source: eric-couchelou.net

Linux-debian-300x145En annexe du paramétrage basique de votre serveur web, il se peut que vous soyez confronté à la nécessité ou l’envie de placer une interdiction d’accès Géolocalisée.

Mais avant de procéder à ce type d’installation, gardez à l’esprit plusieurs choses :

  • Si vous avez plusieurs sites sur le même serveur, tous seront concernés par vos règles, soyez donc sûr et certain qu’aucun d’entre eux n’ait pour cible l’un des pays que vous aller blacklister,
  • La très grande majorité des internautes des pays que vous pouvez considérer comme à risque (Russie, Chine, Taiwan, Roumanie, Brésil…) n’ont pas de mauvaises intentions, vous vous priverez donc volontairement d’une source de trafic potentiel.
  • Internet est ainsi fait que cette solution est loin d’être fiable à 100%, et les filtres géolocalisés facilement contournables

Bref, le jeu en vaut-il la chandelle? Si vous êtes convaincu que oui, alors ce petit tutoriel est fait pour vous. Je vous proposer d’installer le module de surveillance GEOIP.

1 – Installation du programme :

apt-get install libapache2-mod-geoip

2- Configuration du programme :

vi  etc/apache2/mods-available/geoip.conf

Et Mettre :

GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry=1
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry=1
SetEnvIf GEOIP_COUNTRY_CODE RO BlockCountry=1
SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry=1

Deny from env=BlockCountry

Chaque ligne de type SetEnvIf GEOIP_COUNTRY_CODE XX BlockCountry=1 correspond à une restriction d’accès pour un pays où XX définit le code du pays concerné par la règle. Pour info vous trouverez les différents codes pays (FR, DE, etc.) à cette adresse:
http://www.maxmind.com/app/iso3166

Redémarrez Apache :

/etc/init.d/apache2 restart

C’est en place!

Pour la mise à jour, téléchargez les dernières définitions d’IPs (une fois par mois pour la version gratuite) à cette adresse :
http://www.maxmind.com/app/geolitecountry

et remplacer celles existantes dans

/usr/share/GeoIP/GeoIP.dat

J’attire votre attention sur le fait que le blacklistage géolocalisé présenté ci-dessus fonctionne pour Apache, c’est à dire que vous devrez faire des paramétrages supplémentaires si vous voulez interdire les accès aux serveurs email par exemple. Nous verrons cela plus tard…

How do I Find Out Linux CPU Utilization?

25/02/2024 Comments off

Source: nixCraft

Whenever a Linux system CPU is occupied by a process, it is unavailable for processing other requests. Rest of pending requests must wait till CPU is free. This becomes a bottleneck in the system. Following command will help you to identify CPU utilization, so that you can troubleshoot CPU related performance problems.

Finding CPU utilization is one of the important tasks. Linux comes with various utilities to report CPU utilization. With these commands, you will be able to find out:

* CPU utilization
* Display the utilization of each CPU individually (SMP cpu)
* Find out your system’s average CPU utilization since the last reboot etc
* Determine which process is eating the CPU(s)

Old good top command to find out Linux cpu load

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
The top command monitors CPU utilization, process statistics, and memory utilization. The top section contains information related to overall system status – uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space.

Top command to find out Linux cpu usage

Type the top command:
$ top

Output:
linux-gui-info

You can see Linux CPU utilization under CPU stats. The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. In a true SMP environment (multiple CPUS), top will operate in number of CPUs. Please note that you need to type q key to exit the top command display.

The top command produces a frequently-updated list of processes. By default, the processes are ordered by percentage of CPU usage, with only the « top » CPU consumers shown. The top command shows how much processing power and memory are being used, as well as other information about the running processes.

Lire la suite…

Categories: Système Tags: ,