> Best blogg: Linux
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, March 2, 2015

Download vdi kali linux For virtualbox and vmwre


kali linux virtualboxand vimwre
kali linux virtualboxand and vimwre  


Kali Linux is a Debian-derived Linux distribution designed for digital forensics and penetration testing. It is maintained and funded by Offensive Security Ltd. It was developed by Mati Aharoni and Devon Kearns of Offensive Security through the rewrite of BackTrack, their previous forensics Linux distribution


Download kali linux iso        Download 

Download virtuialbox           Download



Download vdi kali linux virtualbox and vmware


VDI image for VirtualBox

VirtualBox (VDI) 32bit Size: 2.5GB                    Download 

VirtualBox (VDI) 64bit Size: 2.4GB                        Download

VMDK image for VMware

VirtualBox (VDI) 32bit Size: 2.5GB           Download

VirtualBox (VDI) 64bit Size: 2.5GB           Download



Kali linux, vdi kali linux, kali linux image for virtualbox, kali linux image   for vmwre, linux for virtualbox

Wednesday, December 3, 2014

The Best Linux distribution

 
best in linux distribution- reseausale.com

Liste Linux distribution

Ubuntu/Kubunt

Fedora

Linux Mint

PinGuy OS

linux Gentoo

Linux Mageia

Linux Tiny Core

 

Puppy Linux

 

 

Friday, November 21, 2014

How to Install Java JDK in Kali Linux

Download the latest Java SE SDK version

Go to the following link and download jdk7. At the time of writing this guide the jdk version was jdk-7u45-linux-x64. Note that I’m using x64 which is 64-bit. 32-bit users should choose their versions accordingly. Not that tough really!
Following is what I’ve used. 

JDK-7u45-Linux-x64 

Again, at the time of writing this guide the available version was jdk-7u45-linux-x64.tar.gz
Download and save the file in /root directory.

UnTar the Archive and move to /opt

tar -xzvf /root/jdk-7u45-linux-x64.tar.gz
mv jdk1.7.0_45 /opt
cd /opt/jdk1.7.0_45

Install and register binaries

This step registers the downloaded version of Java as an alternative, and switches it to be used as the default:
update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_45/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_45/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.7.0_45/bin/java
update-alternatives --set javac /opt/jdk1.7.0_45/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so

Test

First of all, close your browser and re-open. You won’t believe how many users actually forgets to do this step and later complains Java ain’t working. I’d advise to bookmark this site to be able to reopen these instructions quickly, or simply copy these into a leafpad/vi/text file.
To check the version of Java you are now running

java -version
 
To check the browser plugin just click Do I have Java?

Sunday, November 9, 2014

How To Run Android Apps in Chrome on Mac / Linux / Windows

It’s now possible to run Android apps in the Chrome browser — it just takes a little bit of work.
Google has officially brought four Android apps to Chromebooks, so it would seem that it’s only a matter of time before more and more Android apps become officially available on the Chrome browser. If you can’t wait, however, let’s run through a few options for running Android apps in Chrome right now.
Note: We’ll be looking at Chrome on Windows here, but the same processes should work on Macs or Linux devices as well.

Prerequisite: ARChon Custom Runtime

Before getting started, you’ll need to download this Chrome extension. This allows Android apps to work properly on Chrome, but it’s still very much unofficial and unstable, so don’t expect everything to work perfectly.

There are three download options available for the runtime that depend on your system. To check if you have a 32-bit or 64-bit browser, you can navigate to chrome://chrome in your address bar, or you can click the three line menu button in the upper right and select About Google Chrome at the bottom.
android chrome 2   How To Run Android Apps in Chrome on Mac / Linux / Windows

Once you’ve downloaded the correct version (and this may take a while, as it’s a 100MB file), unzip the folder. Then type chrome://extensions into your address bar to view a list of all your current extensions. Here, select the Developer Mode box in the upper right.
android chrome 1   How To Run Android Apps in Chrome on Mac / Linux / Windows

Now you’ll want to press Load unpacked extension and select the folder where you unzipped ARChon. Make sure it is enabled, and you’re good to go. You can now choose from one of the three options below, depending on which you find easiest.
android chrome 3   How To Run Android Apps in Chrome on Mac / Linux / Windows

Option 1: APK Conversion in Android App

Your Android apps as they are now on your phone or tablet are not able to run in Chrome. To make this possible, they have to be repackaged to be compatible with ARChon. This would be a pretty complicated task — if it weren’t for this Android app: ARChon Packager
.
Once you’ve got the app downloaded and installed, open it up. You’ll be given two options for choosing an app: an installed app, or an APK from your phone’s storage. An APK is the installable file for an app, but you don’t need to worry about that if you just want to use a regular app you already have installed. Select Installed application and choose next.

android chrome 8   How To Run Android Apps in Chrome on Mac / Linux / Windows

I chose Pulse as the app I want to try on Chrome. You can then select if you want it to run in phone or tablet mode in Chrome, and if it should be oriented for portrait or landscape. You can also give it access to the files on your PC or enable ADB
 if you’re a developer.

Once you hit Finish, the app will be converted into a nearly Chrome-ready ZIP file. You then need to transfer that file over to your computer either by using a USB cable, or by selecting the share button at the end of the process to email it or upload it to your preferred cloud storage service.
When the ZIP file is on your computer, unzip it. You’ll then want to go back into chrome://extensions, select Load unpacked extensions, and select the unzipped folder. Once it’s loaded in, click Launch to access the app.
android chrome 4   How To Run Android Apps in Chrome on Mac / Linux / Windows
And there you have it. Using this method, Pulse ran perfectly for me.
android chrome pulse   How To Run Android Apps in Chrome on Mac / Linux / Windows
But if you don’t have an Android device, the next option might be better for you.

Option 2: APK Conversion in Chrome App

For this option, you’ll need to download Twerk from the Chrome Web Store. You will also need an APK file already, the installable file for an app. APKs are notoriously hard to get hold of because of the high likelihood of malware in so-called “cracked” apps, but there are quite a few legitimate APKs available for download straight from the developers over at the XDA forums.

If you have obtained a legitimate APK, this method will work perfectly. Otherwise, move on to option 3.
The process here is simple. Launch Twerk from the Chrome App Launcher or enter chrome://apps into your address bar. Then, locate your APK file in your local file browser and drag it over into the Twerk window.
android chrome twerk   How To Run Android Apps in Chrome on Mac / Linux / Windows

You can then select several options, like whether to run it in portrait or landscape, and build it by pressing the pink Android at the bottom. Then you’ll choose where to save it.

After that, head back into your Chrome extensions (chrome://extensions in your address bar) and select Load unpacked extension. Find the folder that Twerk created and select it. Your app should now be in Chrome, and you can launch it just like any other Chrome app!

Option 3: Find Converted APK Online

This option is probably the simplest out there because you don’t have to tinker with any of your own apps. For this one, you’re just going to download apps that are already compatible with ARChon — the biggest disadvantage is the limited amount of apps available like this.

Visit this community-created Google Spreadsheet of apps that have been tested with ARChon. Most of them have a download link at the far right to download the files, but you take your own risk when downloading these. There is no guarantee that they are safe files, so exercise regular caution. You can also try browsing this Chrome APKs subreddit.

Once it is downloaded, unzip it if it’s zipped, go to your Chrome extensions page (chrome://extensions in your address bar), and select Load unpacked extension. Find the unzipped downloaded folder and select it to load it into Chrome. You can now find it at chrome://apps to launch like a regular app!

What Is Your Favorite Android App On Chrome?

As we bide our time until Google makes this an official feature, this is your best bet for getting tons of Android apps running on your Chrome browser.
What is your favorite app that you’ve been able to get running? Do you have any other methods of running Android apps on Chrome that you’d recommend? Let us know in the comments!

Thursday, June 19, 2014

Haw to print in linux

Command-Line Printing in Linux

haw to print in linux
haw to print in linux

 

CUPS provides both the System V (lp(1)) and Berkeley (lpr(1)) printing commands for printing files. In addition, it supported a large number of standard and printer-specific options that allow you to control how and where files are printed.
This guide is taken from the Common Unix Printing System (CUPS) documentation. It is available on any system running CUPS (e.g. EECS Ubuntu Linux Desktops) at http://localhost:631/help/options.html.  You can also find CUPS documentation at www.cups.org.

Printing Files

CUPS understands many different types of files directly, including text, PostScript, PDF, and image files. This allows you to print from inside your applications or at the command-line, whichever is most convenient! Type either of the following commands to print a file to the default (or only) printer on the system:
lp filename lpr filename

Choosing a Printer

Many systems will have more than one printer available to the user. These printers can be attached to the local system via a parallel, serial, or USB port, or available over the network. Use the lpstat(1) command to see a list of available printers:
lpstat -p -d The option specifies that you want to see a list of printers, and the -d option reports the current default printer or class.
Use the -d option with the lp command to print to a specific printer:
lp -d printer filename or the -P option with the lpr command:
lpr -P printer filename

Setting the Default Printer

If you normally use a particular printer, you can tell CUPS to use it by default using the lpoptions(1) command:
lpoptions -d printer

Printing the Output of a Program

Both the lp and lpr commands support printing from the standard input:
program | lp program | lp -d printer program | lpr program | lpr -P printer If the program does not provide any output, then nothing will be queued for printing.

Specifying Printer Options

For many types of files, the default printer options may be sufficient for your needs. However, there may be times when you need to change the options for a particular file you are printing.
The lp and lpr commands allow you to pass printer options using the -o option:
lp -o landscape -o scaling=75 -o media=A4 filename.jpg lpr -o landscape -o scaling=75 -o media=A4 filename.jpg The available printer options vary depending on the printer. The standard options are described in the Standard Printing Options section below. Printer-specific options are also available and can be listed using the lpoptions command:
lpoptions -p printer -l

Creating Saved Options

Saved options are supported in CUPS through printer instances. Printer instances are, as their name implies, copies of a printer that have certain options associated with them. Use the lpoptions command to create a printer instance:
lpoptions -p printer/instance -o name=value ... The -p printer/instance option provides the name of the instance, which is always the printer name, a slash, and the instance name which can contain any printable characters except space and slash. The remaining options are then associated with the instance instead of the main queue. For example, the following command creates a duplex instance of the LaserJet queue:
lpoptions -p LaserJet/duplex -o sides=two-sided-long-edge Instances do not inherit lpoptions from the main queue.

Printing Multiple Copies

Both the lp and lpr commands have options for printing more than one copy of a file:
lp -n num-copies filename lpr -#num-copies filename Copies are normally not collated for you. Use the ”-o Collate=True” option to get collated copies:
lp -n num-copies -o Collate=True filename lpr -#num-copies -o Collate=True filename

Canceling a Print Job

The cancel(1) and lprm(1) commands cancel a print job:
cancel job-id lprm job-id The job-id is the number that was reported to you by the lp command. You can also get the job ID using the lpq(1) or lpstat commands:
lpq lpstat

Moving a Print Job

The lpmove(8) command moves a print job to a new printer or class:
lpmove job-id destination The job-id is the number that was reported to you by the lp or lpstat commands. Destination is the name of a printer or class that you want to actually print the job.
Note: The lpmove command is located in the system command directory (typically /usr/sbin or /usr/local/sbin), and so may not be in your command path. Specify the full path to the command if you get a "command not found" error, for example:
/usr/sbin/lpmove foo-123 bar

Standard Printing Options

The following options apply when printing all types of files.

Selecting the Media Size, Type, and Source

The -o media=xyz option sets the media size, type, and/or source:
lp -o media=Letter filename lp -o media=Letter,MultiPurpose filename lpr -o media=Letter,Transparency filename lpr -o media=Letter,MultiPurpose,Transparency filename The available media sizes, types, and sources depend on the printer, but most support the following options (case is not significant):
  • “Letter” - US Letter (8.5×11 inches, or 216x279mm)
  • “Legal” - US Legal (8.5×14 inches, or 216x356mm)
  • “A4” - ISO A4 (8.27×11.69 inches, or 210x297mm)
  • “COM10” - US #10 Envelope (9.5×4.125 inches, or 241x105mm)
  • “DL” - ISO DL Envelope (8.66×4.33 inches, or 220x110mm)
  • “Transparency” - Transparency media type or source
  • “Upper” - Upper paper tray
  • “Lower” - Lower paper tray
  • “MultiPurpose” - Multi-purpose paper tray
  • “LargeCapacity” - Large capacity paper tray
The actual options supported are defined in the printer's PPD file in the “PageSize”, “InputSlot”, and “MediaType” options. You can list them using the lpoptions(1) command:
lpoptions -p printer -l When “Custom” is listed for the “PageSize” option, you can specify custom media sizes using one of the following forms:
lp -o media=Custom.WIDTHxLENGTH filename
lp -o media=Custom.WIDTHxLENGTHin filename
lp -o media=Custom.WIDTHxLENGTHcm filename
lp -o media=Custom.WIDTHxLENGTHmm filename
where “WIDTH” and “LENGTH” are the width and length of the media in points, inches, centimeters, or millimeters, respectively.

Setting the Orientation

The ”-o landscape” option will rotate the page 90 degrees to print in landscape orientation:
lp -o landscape filename
lpr -o landscape filename
The ”-o orientation-requested=N” option rotates the page depending on the value of N:
  • -o orientation-requested=3
    portrait orientation (no rotation)
  • -o orientation-requested=4
    landscape orientation (90 degrees)
  • -o orientation-requested=5
    reverse landscape or seascape orientation (270 degrees)
  • -o orientation-requested=6
    reverse portrait or upside-down orientation (180 degrees)

Printing On Both Sides of the Paper

The -o sides=two-sided-short-edge and -o sides=two-sided-long-edge options will enable two-sided printing on the printer if the printer supports it. The -o sides=two-sided-short-edge option is suitable for landscape pages, while the -o sides=two-sided-long-edge option is suitable for portrait pages:
lp -o sides=two-sided-short-edge filename
lp -o sides=two-sided-long-edge filename
lpr -o sides=two-sided-long-edge filename
The default is to print single-sided:
lp -o sides=one-sided filename
lpr -o sides=one-sided filename

Selecting the Banner Page(s)

The -o jobsheets=start,end option sets the banner page(s) to use for a job:
lp -o job-sheets=none filename
lp -o job-sheets=standard filename
lpr -o job-sheets=classified,classified filename
If only one banner file is specified, it will be printed before the files in the job. If a second banner file is specified, it is printed after the files in the job.
The available banner pages depend on the local system configuration; CUPS includes the following banner files:
  • “none” - Do not produce a banner page.
  • “classified” - A banner page with a “classified” label at the top and bottom.
  • “confidential” - A banner page with a “confidential” label at the top and bottom.
  • “secret” - A banner page with a “secret” label at the top and bottom.
  • “standard” - A banner page with no label at the top and bottom.
  • “topsecret” - A banner page with a “top secret” label at the top and bottom.
  • “unclassified” - A banner page with an “unclassified” label at the top and bottom./li>

Holding Jobs for Later Printing

The -o job-hold-until=when option tells CUPS to delay printing until the when time, which can be one of the following:
  • -o job-hold-until=indefinite
    print only after released by the user or an administrator
  • -o job-hold-until=day-time
    print from 6am to 6pm local time
  • -o job-hold-until=night
    print from 6pm to 6am local time
  • -o job-hold-until=second-shift
    print from 4pm to 12am local time
  • -o job-hold-until=third-shift
    print from 12am to 8am local time
  • -o job-hold-until=weekend
    print on Saturday or Sunday
  • -o job-hold-until=HH:MM
    print at the specified UTC time

Releasing Held Jobs

Aside from the web interface, you can use the lp command to release a held job:
lp -i job-id -H resume
where “job-id” is the job ID reported by the lpstat command.

Setting the Job Priority

The -o job-priority=NNN option tells CUPS to assign a priority to your job from 1 (lowest) to 100 (highest), which influences where the job appears in the print queue. Higher priority jobs are printed before lower priority jobs, however submitting a new job with a high priority will not interrupt an

Specifying the Output Order

The -o outputorder=normal and -o outputorder=reverse options specify the order of the pages. Normal order prints page 1 first, page 2 second, and so forth. Reverse order prints page 1 last.

Selecting a Range of Pages

The -o page-ranges=pages option selects a range of pages for printing:
lp -o page-ranges=1 filename
lp -o page-ranges=1-4 filename
lp -o page-ranges=1-4,7,9-12 filename
lpr -o page-ranges=1-4,7,9-12 filename
As shown above, the “pages” value can be a single page, a range of pages, or a collection of page numbers and ranges separated by commas. The pages will always be printed in ascending order, regardless of the order of the pages in the “page-ranges” option.
The default is to print all pages.

Selecting Even or Odd Pages

Use the -o page-set=set option to select the even or odd pages:
lp -o page-set=odd filename
lp -o page-set=even filename
lpr -o page-set=even filename
The default is to print all pages.

N-Up Printing

The -o number-up=value option selects N-Up printing. N-Up printing places multiple document pages on a single printed page. CUPS supports 1, 2, 4, 6, 9, and 16-Up formats; the default format is 1-Up:
lp -o number-up=1 filename
lp -o number-up=2 filename
lp -o number-up=4 filename
lpr -o number-up=16 filename
The -o page-border=value option chooses the border to draw around each page:
  • -o page-border=double
    draw two hairline borders around each page
  • -o page-border=double-thick
    draw two 1pt borders around each page
  • -o page-border=none
    do not draw a border (default)
  • -o page-border=single
    draw one hairline border around each page
  • -o page-border=single-thick
    draw one 1pt border around each page
The -o number-up-layout=value option chooses the layout of the pages on each output page:
  • -o number-up-layout=btlr
    Bottom to top, left to right
  • -o number-up-layout=btrl
    Bottom to top, right to left
  • -o number-up-layout=lrbt
    Left to right, bottom to top
  • -o number-up-layout=lrtb
    Left to right, top to bottom (default)
  • -o number-up-layout=rlbt
    Right to left, bottom to top
  • -o number-up-layout=rltb
    Right to left, top to bottom
  • -o number-up-layout=tblr
    Top to bottom, left to right
  • -o number-up-layout=tbrl
    Top to bottom, right to left

Scaling to Fit

The -o fitplot option specifies that the document should be scaled to fit on the page:
lp -o fitplot filename
lpr -o fitplot filename
The default is to use the size specified in the file.
Note:This feature depends upon an accurate size in the print file. If no size is given in the file, the page may be scaled incorrectly!

Printing in Reverse Order

The -o outputorder=reverse option will print the pages in reverse order:
lp -o outputorder=reverse filename
lpr -o outputorder=reverse filename
Similarly, the -o outputorder=normal option will print starting with page 1:
lp -o outputorder=normal filename
lpr -o outputorder=normal filename
The default is -o outputorder=normal for printers that print face down and -o outputorder=reverse for printers that print face up.

Printing Mirrored Pages

The -o mirror option flips each page along the vertical access to produce a mirrored image:
lp -o mirror filename
lpr -o mirror filename
This is typically used when printing on T-shirt transfer media or sometimes on transparencies.

Saturday, June 14, 2014

Linux Screen Recording Just Got Quicker and Easier with ScreenStudio

Recording screencasts on a Linux system historically never has been a lot of fun. If you wanted good performance, you would usually record the screen using a terminal command. If you wanted ease of use, you would probably use a tool like gtkRecordMyDesktop or Kazam, a similar Linux screencast tool. Kazam worked for some people but I always had problems with it myself.
Finally, there’s a new screencaster that offers good performance, has lots of settings to choose from, and has a good interface to configure it all. Take a look at ScreenStudio and see for yourself.

About ScreenStudio

ScreenStudio is a screencasting application that is Java-based, which makes it very easy to run on any distribution. The only dependency besides Java is that your computer has “avconv” installed, which you should be able to find with ease using your respective package manager. Ubuntu users can install it by running the terminal command:
sudo apt-get install libav-tools
Fedora users can run the terminal command:
sudo yum install libav-tools

Record to File

ScreenStudio is an application which tries to be a very useful screencasting tool, and although it’s still aiming to add lots of features, it’s proving to be effective already.

screenstudio record   Linux Screen Recording Just Got Quicker and Easier with ScreenStudio

Of course, with ScreenStudio you’ll be able to record to a file in either FLV or MP4 format. You can also choose between different profiles that can change various parameters for size and quality. It’s pretty simple to figure out and use, really, which is good.

Stream to Service

screenstudio stream   Linux Screen Recording Just Got Quicker and Easier with ScreenStudio

If you don’t want to record your screencast to a file, that’s fine too. Over in a different tab, you have the option to stream to a service like Twitch.TV (learn more about streaming live video to Twitch.tv), UStream (read about Ustream video streaming), or YouTube Live directly. To make this work, you’ll need to configure the server, profile, and stream key so that the server knows which stream to associate your screencast with. It works surprisingly well, assuming that you have a good enough Internet connection to support streaming.

Overlay

screenstudio overlay   Linux Screen Recording Just Got Quicker and Easier with ScreenStudio

No matter if you’re recording to a file or streaming, you can add some customization to your screencast with an overlay. You can add a text overlay, or you can add your webcam’s video stream as the overlay. This is fantastic for screencasts because viewers can then see what you’re doing on screen as well as see you as you’re talking to them. A lot of people tend to add the overlay on later in post-production, but ScreenStudio does this all in one go, and makes it very easy to set up.

Sources

screenstudio sources   Linux Screen Recording Just Got Quicker and Easier with ScreenStudio

Of course, you can also choose between a few other setings, such as which screen you want to record if there are multiple screens, and at how many frames per second it should record. In the same view you can also configure the webcam and choose the desired resolution for use in the overlay.

Miscellaneous

ScreenStudio is being worked on heavily by developer Patrick Balleux. So it’s no surprise when I say that new versions of ScreenStudio are coming out at a rapid pace, and it’s important to check the project’s page on a regular basis for the newest version. Also, if you need any help using ScreenStudio, or just need some creative ideas, Patrick has a bunch of ScreenStudio tutorial videos available on his YouTube channel in the ScreenStudio playlist.

ScreenStudio Screencasting

ScreenStudio is a simple program for a seemingly simple task. However, that task is often a lot more involved than you might think, and ScreenStudio makes it very easy to accomplish a lot when it comes to screencasting. It’s still a relatively recent project, so I’m very excited to see where the application will go in terms of features. While it’s currently nifty, it’s not quite yet a must-have; but I wouldn’t be surprised if that changed in the future.

Have you tried to screencast in Linux? What was your experience? Can you share your setups? Let us know in the comments!

Monday, April 28, 2014

Download mandriva iso


Download mandriva iso


Mandriva Linux, formerly called Mandrake Linux, is a full Linux distribution created by Mandriva. It was initially was based on Red Hat Linux and KDE. In 2004, the distribution was renamed from Mandrake Linux became known as Mandrakelinux and a year later, in 2005, the company's name changed to Mandriva, and the product would be renamed to Mandriva Linux.


Download mandriva iso  






tags: Download mandriva iso, iso, linux, linux mandriva iso, iso



Wednesday, April 23, 2014

Setting Up A Linux File Server Using Samba

 Setting Up A Linux File Server Using Samba

 
Setting Up A Linux File Server Using Samba 
Setting Up A Linux File Server Using Samba

 

Step1

Download Ubuntu Server and create the boot CD, then download the corresponding Ubuntu Server Guide from https://help.ubuntu.com/. I  will be referring to this guide a lot so print it off or keep it open on another PC.

** It is important you use the guide written for your version of Ubuntu  Server as some commands change between versions (this was one of the issues I had with other tutorials). This may also cause problems if you upgrade to a new version of Ubuntu so I suggest you use the most recent LTS (long term support) version and stick to it.

Boot off the CD and follow installation instructions. I selected Guided - Use entire Disk. I did not select LVM as I had issues retrieving data from an earlier attempt, where I screwed up the interfaces file and it wouldn't boot (yes I know you can mount LVM from a Live Disk but I can't be bothered with the hassle) this is a simple home server so I like to keep everything as simple as possible.

Give your server a name, create a user and set a sensible password. (this will also be your admin password so it should include capitals and symbols or numbers), I'll explain more about this later.
**** NB When creating the user make it something like serveradmin. Do not make this username the same as your Windows username. If you do it may cause issues later.****

Select Samba and SSH during the installation procedure by moving up and down with the arrow keys and pressing the space bar. Use the Tab key to skip to the next or back buttons. Now continue with the installation and in a few minutes you will be presented with the Ubuntu Server login screen. If at this stage you were expecting a graphical user interface with shiny buttons and a mouse then you will be disappointed. This can be installed if you really wish but that defeats the purpose of using the server edition of Ubuntu. On this version of Ubuntu you will have to get your hands dirty on the keyboard.

Step 2

Login with your user name and password.
Install updates :-
sudo apt-get update
This just ensures everything is up to date.
You should be prompted for a password. Use the one you created earlier.

Step 3

In the Ubuntu Server Guide you downloaded earlier look for the chapter on Windows Networking and follow the instructions for Samba File Server.

NB You shouldn't need to run the install command for Samba as it was installed earlier but if you have run it and are being asked which version of smb.conf you want, I suggest you keep the one already installed. This is especially true if you have already made changes to it.

** Before you start editing the smb.conf file, copy it to something like smb.conf_backup. You will probably cock things up the first time you attempt this so it is nice to be able to get back to square one. :- 
 
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
I use Nano for editing text files from the CLI (command line interface). I hate Vi with a passion, that may be cause I'm a bit thick, but I find Nano much easier to use. So your command to edit the smb.conf file will be :-
sudo nano /etc/samba/smb.conf
You need to be an admin user to save any changes when you're finished editing, hence the sudo in front of nano.

In Ubuntu any command which may change the server configuration needs to be carried out by the admin user. Since for security reasons you cannot login as root (the admin user) the alternative is to insert sudo before every command then provide the admin password, this keeps things nice and secure. Other Distros allow you to type su (for super user) then the password and this will give admin access until you logout.

Check the workgroup name in your Windows PC by right clicking on My Computer, select properties and Computer name. It will probably be WORKGROUP or MSHOME, depending on your version of XP. Sorry not sure how to find out in Vista or W7 but probably something similar.

Now follow the instructions carefully. Some of the commands are already in the smb.conf file but have a # symbol in front of them, removing the # symbol makes the command active.

To close Nano and save your changes press CTRL and X, type y and press enter. CTRL and O is shown as Write out which just means SAVE, if you want to save it as you go along.

NB. Pretty much everything in Linux is case sensitive, i.e. If you gave your folder names capitals when creating, them then you MUST use capitals when referring to them or moving around the file structure. Linux will see Music and music as two completely different folders.

Step 4

This bit may or may not be necessary, as far as I can see it depends on the version of Ubuntu Server and whether or not you installed Samba as part of the server installation. To connect from either a Linux or Windows PC you need to make one more small change. Look for the area in smb.conf marked Authentication, and just below the bit where you set security to user, change:-

encrypt passwords = false 
 
to

encrypt passwords = true
Save it, restart Samba by the method suggested for your version of Ubuntu Server (it seems to change between versions) or just reboot the server and you should done.

Step 5

Now to the bit nobody else mentions in their tutorials and I had to figure out for myself. How do I connect to the bugger?!!! I tried browsing "Network Connections" but that didn't work, possibly because at this point we haven't created Samba users to match our Windows users but anyhow we don't need to. Here is how I did it.

Note you experts out there may criticize my way of doing this but it's simple and it works so don't knock it.

If not sure of your server IP address just type ifconfig at the command prompt. This will give you a full breakdown of your network details.
From a Win XP Pro machine (sorry not sure it this is the same for other versions of Windows but it should be similar).

Open My Computer.
Click on Tools and Map network Drive.

In the window labeled Folder, enter the IP address of your server preceded by \\ and followed by \sharename (where sharename is the name of the share you created earlier).

e.g. :- \\192.168.1.4\Music or \\192.168.0.5\Photos

Press Finish and if everything has worked you should now see the network folder. You can create a shortcut to it for easy access in the future but Windows should remember the network drive name you just created.
To connect from a Linux PC:- (I am using Ubuntu 10.10, sorry not sure about other Distros but other versions of Ubuntu should be similar)

Click on Places and select Connect to Server.
Select Windows Share and type in the server IP address in the window labeled Server.
Enter the share name you created, put a tick in create bookmark (this just makes Ubuntu remember the path after logout or reboot) and click on connect. Do not enter any username or password, it shouldn't be necessary if you followed the guide earlier.

And that's it. Yippee you now have a working file server.

During installation you installed SSH and having SSH running on your server in default mode can be a security risk, so we want to sort that. We need to change the default port to a random number of your own choosing. To do this follow the instructions in the Ubuntu Server Guide under the chapter Remote Administration. The default port is 22 which many people don't bother changing so this is the one used by hackers and hacking software to try and gain access to your server. There are a few other options there but I haven't bothered with them.

Step 6

Unless you chose to give your server a static IP address during installation it will have a DHCP address assigned to it by your router. This would be fine so long as you never reboot your router or shutdown the server. Sooner or later though it will pick up a different IP address and you will be left disconnected, so we will give it a static one. Check the current IP address by typing

ifconfig
at the command prompt. You only want to change the last part so for example if it is 192.168.1.5 then change it to 192.168.1.101. You can set the last part to be any number between 2 and 254, mine is 101.
In the Ubuntu Server Guide open the chapter Networking – Network Configuration - IP addressing and select Static IP Address Assignment.
sudo nano /etc/network/interfaces
It should look something like

auto eth0
iface eth0 inet static
  address 192.168.1.101
  netmask 255.255.255.0 
  gateway 192.168.1.1
 
The gateway is normally the IP address of your router which is usually 192.168.1.1 or 192.168.0.1 but may be something completely different. If you ran
ipconfig
on your Windows PC it should have shown you the gateway address. If in doubt check your manual or Google the model of your router.
You might also want to check the IP address of your Windows PC, it should be similar to the server but it may previously have been set to a static address.

Run
cmd
from the Start button (or Start and Run in XP). Then type

ipconfig 
at the command prompt. This should show your IP address which will be something like 192.168.1.5 or 192.168.0.3. Whatever it is your PC and server should be in the same range of IP addresses (this just means the first three parts should be the same).

Step 7

Now that you've a working server you'll want to tuck it away somewhere, minus monitor, k/b and mouse of course (if your system board can boot without a k/b that is, it should be an option in the BIOS to ignore errors on boot). During the initial installation of Ubuntu Server you selected to install SSH. This is a protocol (program) which allows you to administer your server remotely from any PC (or even smart phone). If you didn't don't worry, just type:-

sudo apt-get install openssh-server
The easiest way to connect from another PC is to install Putty. A quick Google of Putty will have you up and running in a few seconds. When you launch Putty you will see it asking for a Host Name (or IP address). Just type in your server IP address and new port number, ensure SSH is selected, type a name into Saved sessions and click save, then click open. Say Yes to the security question and your connected. Now you can administer the server from your PC/laptop or even smart phone, how cool is that!

So there you have it. You've installed Ubuntu Server and configured it to let your Windows or Linux box connect to it. There are many more things your server can do for you, it can act as a Proxy server screening your network from the Internet and caching frequently used web sites, or as an email server, or a print server etc.

I'm no expert on Linux and I am sure there are other ways to achieve all this. Some of them may even be better but This method is tried and tested several times and if you follow the steps as shown it should work. If you have any suggestions for improving this tutorial then please let us all know .



Tags: Setting Up A Linux File Server Using Samba, Linux File Server, linux, server, linux samba, Linux File Server

Tuesday, April 8, 2014

how to configure linux vlan


how to configure linux vlan

VLAN is an acronym for Virtual Local Area Network. Several VLANs can co-exist on a single physical switch, which are configured via Linux software and not through hardware interface (you still need to configure actual hardware switch too).

Hubs or switch connects all nodes in a LAN and node can communicate without a router. For example, all nodes in LAN A can communicate with each other without the need for a router. If a node from LAN A wants to communicate with LAN B node, you need to use a router. Therefore, each LAN (A, B, C and so on) are separated using a router.
VLAN as a name suggest combine multiple LANs at once. But, what are the advantages of VLAN?
  • Performance.
  • Ease of management.
  • Security.
  • Trunks.
  • VLANs give you the ability to sub-divide a LAN for security purpose.
  • You don't have to configure any hardware device, when physically moving server computer to another location and more.
Fundamental discussion about VLAN or switches is beyond the scope of this blog post. I suggest the following textbooks:

A note about your LAN hardware

  1. To be able to use VLANs you will need a switch that support the IEEE 802.1q standard on an Ethernet network.
  2. You will also need a NIC (Network Interface Card) that works with Linux and support 802.1q standard .

Linux VLAN configuration issues

I am lucky enough to get a couple of hints from our internal wiki:
  • Not all network drivers support VLAN. You may need to patch your driver.
  • MTU may be another problem. VLAN works by tagging each frame i.e. an Ethernet header extension that enlarges the header from 14 to 18 bytes. The VLAN tag contains the VLAN ID and priority.
  • Do not use VLAN ID 1 as it may be used for admin purpose.
Enough talk, let's get to the Linux VLAN configurations.

Setting up 802.1q VLAN tagging by loading 8021q Linux kernel driver

First, make sure that the Linux kernel driver (module) called 8021q is loaded:
# lsmod | grep 8021q
If the module is not loaded, load it with the following modprobe command:
# modprobe 8021q

Method #1: CentOS/RHLE/Fedora Linux VLAN HowTo

I am using RHEL/CentOS Linux with VLAN ID # 5. So I need to copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.5
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.5
Now, I've one network card (eth0) and it needs to tagged network traffic for VLAN ID 5.
  • eth0 - Your regular network interface
  • eth0.5 - Your virtual interface that use untagged frames
Do not modify /etc/sysconfig/network-scripts/ifcfg-eth0 file. Now open file /etc/sysconfig/network-scripts/ifcfg-eth0.5 using a text editor such as vi, type:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0.5
Find DEVICE=eth0 line and replace with:
DEVICE=eth0.5
Also, append the following line:
VLAN=yes
Make sure you assign correct IP address using DHCP or static IP. Remove gateway entry from all other network config files. Only add gateway to /etc/sysconfig/network file. This whole configuration may sound complicated. So I am including sample configurations files for you:

/etc/sysconfig/network-scripts/ifcfg-eth0.5 file

# VLAN configuration for my eth0  with ID - 5 #
DEVICE=eth0.5
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.5
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.1.0
VLAN=yes
 

/etc/sysconfig/network-scripts/ifcfg-eth0 file

# Actual configuration for my eth0 physical interface ##
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
 
Finally, restart networking service on a CentOS/RHEL/Fedora Linux, type:
# /etc/init.d/network restart
OR
# service network restart
NOTE: If you need a second VLAN i.e. you need to configure for VLAN ID 2 then copy the /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.2 and do the above procedure again.

Method #2: Using the vconfig command

Above method is perfect and works with a Red hat Enterprise Linux / CentOS / Fedora Linux without any problem. However, you will notice that there is a command called vconfig. The vconfig program allows you to create and remove vlan-devices on a vlan enabled kernel. Vlan-devices are virtual Ethernet devices which represents the virtual lans on the physical lan. This is yet another method of configuring VLAN. To add VLAN ID 5 with following command for eth0 interface:
# vconfig add eth0 5
The vconfig add command creates a vlan-device on eth0 which result into eth0.5 interface. You can use normal ifconfig command to see device information:
# ifconfig eth0.5
Use ifconfig command to assign IP address to vlan interfere:
# ifconfig eth0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
To get detailed information about VLAN interface, type:
# cat /proc/net/vlan/eth0.5
If you wish to delete VLAN interface use delete command as follows:
# ifconfig eth0.5 down
# vconfig rem eth0.5

See vconfig(8) Linux man page for more information on syntax and examples.

Method #3: Create the VLAN device using the ip command

Use the ip command as follows for the interface eth0, and the vlan id is 5:
# ip link add link eth0 name eth0.5 type vlan id 5
# ip link
# ip -d link show eth0.5

You need to activate and add an IP address to vlan link, type:
# ip addr add 192.168.1.200/24 brd 192.168.1.255 dev eth0.5
# ip link set dev eth0.5 up

All traffic will go through the eth0 interface bith with a BLAN tag 5. Only VLAN aware devices can accept the traffic, otherwise the traffic is dropped.

How can I remove VLAN ID 5?

Type the following commands
# ip link set dev eth0.5 down
# ip link delete eth0.5

How do I make above VLAN configuration permanent on a Debian or Ubuntu based system?

Edit the /etc/network/interfaces file, enter:
$ sudo vi /etc/network/interfaces
Update configuration as follows:
## vlan for eth0 with ID - 5 on a Debian/Ubuntu Linux##
auto eth0.5
iface eth0.5 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    vlan-raw-device eth0
 
Save and close the file.

Wednesday, March 26, 2014

basic linux commands list

                                basic linux commands list 
 

 
 Hey,Guys i want to shar  best basic linux commands list  
 
alias    Create an alias •
  apropos  Search Help manual pages (man -k)
  apt-get  Search for and install software packages (Debian/Ubuntu)
  aptitude Search for and install software packages (Debian/Ubuntu)
  aspell   Spell Checker
  awk      Find and Replace text, database sort/validate/index
b
  basename Strip directory and suffix from filenames
  bash     GNU Bourne-Again SHell 
  bc       Arbitrary precision calculator language 
  bg       Send to background
  break    Exit from a loop •
  builtin  Run a shell builtin
  bzip2    Compress or decompress named file(s)
c
  cal      Display a calendar
  case     Conditionally perform a command
  cat      Concatenate and print (display) the content of files
  cd       Change Directory
  cfdisk   Partition table manipulator for Linux
  chgrp    Change group ownership
  chmod    Change access permissions
  chown    Change file owner and group
  chroot   Run a command with a different root directory
  chkconfig System services (runlevel)
  cksum    Print CRC checksum and byte counts
  clear    Clear terminal screen
  cmp      Compare two files
  comm     Compare two sorted files line by line
  command  Run a command - ignoring shell functions •
  continue Resume the next iteration of a loop •
  cp       Copy one or more files to another location
  cron     Daemon to execute scheduled commands
  crontab  Schedule a command to run at a later time
  csplit   Split a file into context-determined pieces
  cut      Divide a file into several parts
d
  date     Display or change the date & time
  dc       Desk Calculator
  dd       Convert and copy a file, write disk headers, boot records
  ddrescue Data recovery tool
  declare  Declare variables and give them attributes •
  df       Display free disk space
  diff     Display the differences between two files
  diff3    Show differences among three files
  dig      DNS lookup
  dir      Briefly list directory contents
  dircolors Colour setup for `ls'
  dirname  Convert a full pathname to just a path
  dirs     Display list of remembered directories
  dmesg    Print kernel & driver messages 
  du       Estimate file space usage
e
  echo     Display message on screen •
  egrep    Search file(s) for lines that match an extended expression
  eject    Eject removable media
  enable   Enable and disable builtin shell commands •
  env      Environment variables
  ethtool  Ethernet card settings
  eval     Evaluate several commands/arguments
  exec     Execute a command
  exit     Exit the shell
  expect   Automate arbitrary applications accessed over a terminal
  expand   Convert tabs to spaces
  export   Set an environment variable
  expr     Evaluate expressions
f
  false    Do nothing, unsuccessfully
  fdformat Low-level format a floppy disk
  fdisk    Partition table manipulator for Linux
  fg       Send job to foreground 
  fgrep    Search file(s) for lines that match a fixed string
  file     Determine file type
  find     Search for files that meet a desired criteria
  fmt      Reformat paragraph text
  fold     Wrap text to fit a specified width.
  for      Expand words, and execute commands
  format   Format disks or tapes
  free     Display memory usage
  fsck     File system consistency check and repair
  ftp      File Transfer Protocol
  function Define Function Macros
  fuser    Identify/kill the process that is accessing a file
g
  gawk     Find and Replace text within file(s)
  getopts  Parse positional parameters
  grep     Search file(s) for lines that match a given pattern
  groupadd Add a user security group
  groupdel Delete a group
  groupmod Modify a group
  groups   Print group names a user is in
  gzip     Compress or decompress named file(s)
h
  hash     Remember the full pathname of a name argument
  head     Output the first part of file(s)
  help     Display help for a built-in command •
  history  Command History
  hostname Print or set system name
i
  iconv    Convert the character set of a file
  id       Print user and group id's
  if       Conditionally perform a command
  ifconfig Configure a network interface
  ifdown   Stop a network interface 
  ifup     Start a network interface up
  import   Capture an X server screen and save the image to file
  install  Copy files and set attributes
j
  jobs     List active jobs •
  join     Join lines on a common field
k
  kill     Stop a process from running
  killall  Kill processes by name
l
  less     Display output one screen at a time
  let      Perform arithmetic on shell variables •
  link     Create a link to a file 
  ln       Create a symbolic link to a file
  local    Create variables •
  locate   Find files
  logname  Print current login name
  logout   Exit a login shell •
  look     Display lines beginning with a given string
  lpc      Line printer control program
  lpr      Off line print
  lprint   Print a file
  lprintd  Abort a print job
  lprintq  List the print queue
  lprm     Remove jobs from the print queue
  ls       List information about file(s)
  lsof     List open files
m
  make     Recompile a group of programs
  man      Help manual
  mkdir    Create new folder(s)
  mkfifo   Make FIFOs (named pipes)
  mkisofs  Create an hybrid ISO9660/JOLIET/HFS filesystem
  mknod    Make block or character special files
  more     Display output one screen at a time
  mount    Mount a file system
  mtools   Manipulate MS-DOS files
  mtr      Network diagnostics (traceroute/ping)
  mv       Move or rename files or directories
  mmv      Mass Move and rename (files)
n
  netstat  Networking information
  nice     Set the priority of a command or job
  nl       Number lines and write files
  nohup    Run a command immune to hangups
  notify-send  Send desktop notifications
  nslookup Query Internet name servers interactively
o
  open     Open a file in its default application
  op       Operator access 
p
  passwd   Modify a user password
  paste    Merge lines of files
  pathchk  Check file name portability
  ping     Test a network connection
  pkill    Stop processes from running
  popd     Restore the previous value of the current directory
  pr       Prepare files for printing
  printcap Printer capability database
  printenv Print environment variables
  printf   Format and print data •
  ps       Process status
  pushd    Save and then change the current directory
  pv       Monitor the progress of data through a pipe 
  pwd      Print Working Directory
q
  quota    Display disk usage and limits
  quotacheck Scan a file system for disk usage
  quotactl Set disk quotas
r
  ram      ram disk device
  rcp      Copy files between two machines
  read     Read a line from standard input •
  readarray Read from stdin into an array variable •
  readonly Mark variables/functions as readonly
  reboot   Reboot the system
  rename   Rename files
  renice   Alter priority of running processes 
  remsync  Synchronize remote files via email
  return   Exit a shell function
  rev      Reverse lines of a file
  rm       Remove files
  rmdir    Remove folder(s)
  rsync    Remote file copy (Synchronize file trees)
s
  screen   Multiplex terminal, run remote shells via ssh
  scp      Secure copy (remote file copy)
  sdiff    Merge two files interactively
  sed      Stream Editor
  select   Accept keyboard input
  seq      Print numeric sequences
  set      Manipulate shell variables and functions
  sftp     Secure File Transfer Program
  shift    Shift positional parameters
  shopt    Shell Options
  shutdown Shutdown or restart linux
  sleep    Delay for a specified time
  slocate  Find files
  sort     Sort text files
  source   Run commands from a file '.'
  split    Split a file into fixed-size pieces
  ssh      Secure Shell client (remote login program)
  strace   Trace system calls and signals
  su       Substitute user identity
  sudo     Execute a command as another user
  sum      Print a checksum for a file
  suspend  Suspend execution of this shell •
  sync     Synchronize data on disk with memory
t
  tail     Output the last part of file
  tar      Store, list or extract files in an archive
  tee      Redirect output to multiple files
  test     Evaluate a conditional expression
  time     Measure Program running time
  timeout  Run a command with a time limit
  times    User and system times
  touch    Change file timestamps
  top      List processes running on the system
  traceroute Trace Route to Host
  trap     Run a command when a signal is set(bourne)
  tr       Translate, squeeze, and/or delete characters
  true     Do nothing, successfully
  tsort    Topological sort
  tty      Print filename of terminal on stdin
  type     Describe a command •
u
  ulimit   Limit user resources •
  umask    Users file creation mask
  umount   Unmount a device
  unalias  Remove an alias •
  uname    Print system information
  unexpand Convert spaces to tabs
  uniq     Uniquify files
  units    Convert units from one scale to another
  unset    Remove variable or function names
  unshar   Unpack shell archive scripts
  until    Execute commands (until error)
  uptime   Show uptime
  useradd  Create new user account
  userdel  Delete a user account
  usermod  Modify user account
  users    List users currently logged in
  uuencode Encode a binary file 
  uudecode Decode a file created by uuencode
v
  v        Verbosely list directory contents (`ls -l -b')
  vdir     Verbosely list directory contents (`ls -l -b')
  vi       Text Editor
  vmstat   Report virtual memory statistics
w
  wait     Wait for a process to complete •
  watch    Execute/display a program periodically
  wc       Print byte, word, and line counts
  whereis  Search the user's $path, man pages and source files for a program
  which    Search the user's $path for a program file
  while    Execute commands
  who      Print all usernames currently logged in
  whoami   Print the current user id and name (`id -un')
  wget     Retrieve web pages or files via HTTP, HTTPS or FTP
  write    Send a message to another user 
x
  xargs    Execute utility, passing constructed argument list(s)
  xdg-open Open a file or URL in the user's preferred application.
  yes      Print a string until interrupted
  zip      Package and compress (archive) files.
  .        Run a command script in the current shell
  !!       Run the last command again
  ###      Comment / Remark
 
 
 
basic linux commands list 
basic linux commands 
linux commands list     
 linux commands 

Wednesday, March 19, 2014

book Linux Fundamentals

Linux Fundamentals


Linux Systems Administration: Fundamentals of Linux Security

In this course, you will learn the basics of Linux system security. These are some of the tools and skills a system administrator needs to become a security engineer. This course focuses on network security issues and will help you improve the security of your systems by starting to think like an attacker.
Upon completion of this course, you will be able to:
  • Verify password security.
  • Enforce password strength via system policies.
  • Assess system service security both locally and remotely
  • Identify unknown open ports.
  • Disable unwanted, insecure services.
  • Analyze network packet captures for unencrypted data.
  • Implement local system firewall controls using IPTables.
From beginning to end, you will learn by doing Linux-based projects and submitting them for instructor feedback. These projects, as well as the final project, will add to your portfolio. Besides a browser and Internet connection, all software is provided by The O’Reilly School of Technology.

Download book now

Saturday, March 15, 2014

linux ebook free

ebook Linux Training

Download Linux Servers - Linux Training

 

 

 

 

 

ebook Introduction to Linux (Third Edition)

Download "Introduction to Linux" (Third Edition)

 

Tuesday, March 11, 2014

How To Make An RPM With Red Hat Package Manage

RPM — the Package Manager

 

In SUSE LINUX, RPM (Red Hat Package Manager) is used for managing the software packages. Its main programs are rpm and rpmbuild. The powerful RPM database can be queried by the users, the system administrators, and package builders for detailed information about the installed software.
Essentially, rpm has five modes: installing, uninstalling, or updating software packages; rebuilding the RPM database; querying RPM bases or individual RPM archives; integrity checks of packages; and signing packages. rpmbuild can be used to build installable packages from pristine sources.
Installable RPM archives are packed in a special binary format. These archives consist of the program files to install and certain meta information used during the installation by rpm to configure the software package or stored in the RPM database for documentation purposes. RPM archives normally have the extension .rpm.
rpm can be used to administer LSB-compliant packages. Refer to Section 12.1.1. “Linux Standard Base (LSB)” for more information about LSB.
[Tip]Tip
For a number of packages, the components needed for software development (libraries, headers, include files, etc.) have been put into separate packages. These development packages are only needed if you want to compile software yourself, for example, the most recent GNOME packages. They can be identified by the name extension -devel, such as the packages alsa-devel, gimp-devel, and kdelibs-devel.

2.3.1. Verifying Package Authenticity

SUSE LINUX RPM packages have a GnuPG signature:
1024D/9C800ACA 2000-10-19 SuSE Package Signing Key <build@suse.de>
Key fingerprint = 79C1 79B2 E1C8 20C1 890F  9994 A84E DAE8 9C80 0ACA
The command rpm --checksig apache-1.3.12.rpm can be used to verify the signature of an RPM package to determine whether it really originates from SUSE or from another trustworthy facility. This is especially recommended for update packages from the Internet. The SUSE public package signature key normally resides in /root/.gnupg/. Since version 8.1, the key is additionally located in the directory /usr/lib/rpm/gnupg/ to enable normal users to verify the signature of RPM packages.

2.3.2. Managing Packages: Install, Update, and Uninstall

Normally, the installation of an RPM archive is quite simple: rpm -i <package>.rpm With this command, the package will be installed — but only if its dependencies are fulfilled and there are no conflicts with other packages. With an error message, rpm requests those packages that need to be installed to meet dependency requirements. In the background, the RPM database ensures that no conflicts arise — a specific file can only belong to one package. By choosing different options, you can force rpm to ignore these defaults, but this is only for experts. Otherwise, risk compromising the integrity of the system and possibly jeopardize the ability to update the system.
The options -U or --upgrade and -F or --freshen can be used to update a package.
rpm -F <package>.rpm
This command will remove the files of the old version and immediately install the new files. The difference between the two versions is that -U installs packages that previously did not exist in the system, but -F merely updates previously installed packages. When updating, rpm updates configuration files carefully using the following strategy:

  • If a configuration file was not changed by the system administrator, rpm will install the new version of the appropriate file. No action by the system administrator is required.
  • If a configuration file was changed by the system administrator before the update, rpm saves the changed file with the extension .rpmorig or .rpmsave (backup file) and installs the version from the new package, but only if the originally installed file and the newer version are different. If this is the case, compare the backup file (.rpmorig or .rpmsave) with the newly installed file and make your changes again in the new file. Afterwards, be sure to delete all .rpmorig and .rpmsave files to avoid problems with future updates.
  • .rpmnew files appear if the configuration file already exists and if the noreplace label was specified in the .spec file.
Following an update, .rpmsave and .rpmnew files should be removed after comparing them, so they do not obstruct future updates. The .rpmorig extension is assigned if the file has not previously been recognized by the RPM database.
Otherwise, .rpmsave is used. In other words, .rpmorig results from updating from a foreign format to RPM. .rpmsave results from updating from an older RPM to a newer RPM. .rpmnew does not disclose any information as to whether the system administrator has made any changes to the configuration file. A list of these files is available in /var/adm/rpmconfigcheck. Some configuration files (like /etc/httpd/httpd.conf) are not overwritten to allow continued operation.
The -U switch is not just an equivalent to uninstalling with the -e option and installing with the -i option. Use -U whenever possible.
[Important]Important
Following every update, check the backup copies with the extension .rpmorig or .rpmsave, which are created by rpm. These are your old configuration files. If necessary, adopt your modifications from the backup copies to the new configuration file then delete the old files with the extension .rpmorig or .rpmsave.
To remove a package, enter rpm -e package. rpm will only delete the package if there are no unresolved dependencies. It is theoretically impossible to delete Tcl/Tk, for example, as long as another application requires it. Even in this case, RPM calls for assistance from the database. If such a deletion is — for whatever reason and under unusual circumstances — impossible, even if no additional dependencies exist, it may be helpful to rebuild the RPM database using the option --rebuilddb.

2.3.3. RPM and Patches

To guarantee the operational security of a system, update packages must be installed in the system from time to time. Previously, a bug in a package could only be eliminated by replacing the entire package. Large packages with small bugs could easily result in large amounts of data. However, since SUSE 8.1, the SUSE RPM offers a new feature enabling the installation of patches in packages.
The most important considerations are demonstrated using pine as an example:
  • Is the patch RPM suitable for my system?
    To check this, first query the installed version of the package. For pine, this can be done with
    rpm -q pine
    pine-4.44-188
    
    Then check if the patch RPM is suitable for this version of pine:
    rpm -qp --basedon pine-4.44-224.i586.patch.rpm 
    pine = 4.44-188
    pine = 4.44-195
    pine = 4.44-207
    This patch is suitable for three different versions of pine. The installed version in the example is also listed, so the patch can be installed.
  • Which files are replaced by the patch?
    The files affected by a patch can easily be seen in the patch RPM. The rpm parameter -P allows selection of special patch features. Display the list of files with the following command:
    rpm -qpPl pine-4.44-224.i586.patch.rpm
    /etc/pine.conf
    /etc/pine.conf.fixed
    /usr/bin/pine
    
    or, if the patch is already installed, with the following command:
    rpm -qPl pine
    /etc/pine.conf
    /etc/pine.conf.fixed
    /usr/bin/pine
    
  • How can a patch RPM be installed in the system?
    Patch RPMs are used just like normal RPMs. The only difference is that a suitable RPM must already be installed.
  • Which patches are already installed in the system and for which package versions?
    A list of all patches installed in the system can be displayed with the command rpm -qPa. If only one patch is installed in a new system (as in this example), the list appear as follows:
    rpm -qPa
    pine-4.44-224
    
    If, at a later date, you want to know which package version was originally installed, this information is also available in the RPM database. For pine, this information can be displayed with the following command:
    rpm -q --basedon pine
    pine = 4.44-188
    
More information, including information about the patch feature of RPM, is available in man rpm and in man rpmbuild.

2.3.4. RPM Queries

With the -q option, rpm initiates queries, making it possible to inspect an RPM archive (by adding the option -p) and also to query the RPM database of installed packages. Several switches are available to specify the type of information required (see Table 2.2. “The Most Important RPM Query Options (-q [-p] …package)”).

Table 2.2. The Most Important RPM Query Options (-q [-p] …package)
-iPackage information
-lFile list
-f FILEQuery a package owned by FILE (the full path must be specified with FILE)
-sFile list with status information (implies -l)
-dList only documentation files (implies -l)
-cList only configuration files (implies -l)
--dumpFile list with complete details (to be used with -l, -c, or -d)
--providesList features of the package that another package can request with --requires
--requires, -RCapabilities the package requires
--scriptsInstallation scripts (preinstall, postinstall, uninstall)
For example, the command rpm -q -i wget displays the information shown in Output 2.2. “rpm -q -i wget”.

Example 2.2. rpm -q -i wget
Name        :wget                   Relocations: (not relocateable)
Version     :1.8.2                  Vendor: SuSE Linux AG, Nuernberg, Germany
Release     :301                    Build Date: Di 23 Sep 2003 20:26:38 CEST
Install date:Mi 08 Okt 2003 11:46:31 CEST Build Host: levi.suse.de
Group       :Productivity/Networking/Web/Utilities 
Source RPM  :wget-1.8.2-301.src.rpm
Size        :1333235                          License: GPL
Signature   :DSA/SHA1, Di 23 Sep 2003 22:13:12 CEST, Key ID a84edae89c800aca
Packager    :http://www.suse.de/feedback
URL         :http://wget.sunsite.dk/
Summary     :A tool for mirroring FTP and HTTP servers
Description :
Wget enables you to retrieve WWW documents or FTP files from a server.
This can be done in script files or via the command line.
[...]
The option -f only works if you specify the complete file name with its full path. Provide as many file names as desired. For example, the following command
rpm -q -f /bin/rpm /usr/bin/wget
results in:
rpm-3.0.3-3
wget-1.5.3-55
If only part of the file name is known, use a shell script as shown in File 2.3. “Script to Search for Packages”. Pass the partial file name to the script shown as a parameter when running it.

Example 2.3. Script to Search for Packages
#! /bin/sh
for i in $(rpm -q -a -l | grep  $1); do
    echo "\"$i\" is in package:"
    rpm -q -f $i
    echo ""
done
The command rpm -q --changelog rpm displays a detailed list of information (updates, configuration, modifications, etc.) about a specific package. This example shows information about the package rpm. However, only the last five change entries in the RPM database are listed. All entries (dating back the last two years) are included in the package itself. This query only works if CD 1 is mounted at /media/cdrom:
rpm -qp --changelog /media/cdrom/suse/i586/rpm-3*.rpm
With the help of the installed RPM database, verification checks can be made. These checks are initiated with the option -V, -y, or --verify. With this option, rpm shows all files in a package that have been changed since installation. rpm uses eight character symbols to give some hints about the following changes:


Table 2.3. RPM Verify Options
5MD5 check sum
SFile size
LSymbolic link
TModification time
DMajor and minor device numbers
UOwner
GGroup
MMode (permissions and file type)
In the case of configuration files, the letter c is printed. Example for changes to /etc/wgetrc (wget):
rpm -V wget
S.5....T c /etc/wgetrc
The files of the RPM database are placed in /var/lib/rpm. If the partition /usr has a size of 1 GB, this database can occupy nearly 30 MB, especially after a complete update. If the database is much larger than expected, it is useful to rebuild the database with the option --rebuilddb. Before doing this, make a backup of the old database. The cron script cron.daily makes daily copies of the database (packed with gzip) and stores them in /var/adm/backup/rpmdb. The number of copies is controlled by the variable MAX_RPMDB_BACKUPS (default: 5) in /etc/sysconfig/backup. The size of a single backup is approximately 3 MB for 1 GB in /usr.

2.3.5. Installing and Compiling Source Packages

All source packages of SUSE LINUX carry a .src.rpm extension (source RPM).
[Tip]Tip
Source packages can be installed with YaST, like any other package. They will not, however, be marked as installed ([i]) in the package manager. This is because the source packages are not entered in the RPM database. Only installed operating system software is listed in the RPM database.
The following directories must be available for rpm and rpmbuild in /usr/src/packages (unless you specified custom settings in a file like /etc/rpmrc):
SOURCES
for the original sources (.tar.gz files, etc.) and for distribution-specific adjustments (.dif files)
SPECS
for the .spec files, similar to a meta Makefile, which control the build process
BUILD
all the sources are unpacked, patched, and compiled in this directory
RPMS
where the completed binary packages are stored
SRPMS
here are the source RPMs
When you install a source package with YaST, all the necessary components will be installed in /usr/src/packages: the sources and the adjustments in SOURCES and the relevant .spec file in SPECS.
[Warning]Warning
Do not experiment with system components (glibc, rpm, sysvinit, etc.), as this endangers the operability of your system.
The following example uses the wget.src.rpm package. After installing the package with YaST, you should have the following files:
/usr/src/packages/SPECS/wget.spec
/usr/src/packages/SOURCES/wget-1.4.5.dif
/usr/src/packages/SOURCES/wget-1.4.5.tar.gz
rpmbuild -b X /usr/src/packages/SPECS/wget.spec starts the compilation. X is a wild card for various stages of the build process (see the output of --help or the RPM documentation for details). The following is merely a brief explanation:
-bp
Prepare sources in /usr/src/packages/BUILD: unpack and patch.
-bc
Do the same as -bp, but with additional compilation.
-bi
Do the same as -bp, but with additional installation of the built software. Caution: if the package does not support the BuildRoot feature, you might overwrite configuration files.
-bb
Do the same as -bi, but with the additional creation of the binary package. If the compile was successful, the binary should be in /usr/src/packages/RPMS.
-ba
Do the same as -bb, but with the additional creation of the source RPM. If the compilation was successful, the binary should be in /usr/src/packages/SRPMS.
--short-circuit
Allows skipping specific steps.
The binary RPM created can now be installed with rpm -i or, preferably, with rpm -U. Installation with rpm makes it appear in the RPM database.

2.3.6. Compiling RPM Packages with build

The danger with many packages is that unwanted files are added to the running system during the build process. To prevent this, use build, which creates a defined environment in which the package is built. To establish this chroot environment, the build script must be provided with a complete package tree. This tree can be made available on the hard disk, via NFS, or from DVD. The respective position is specified with build --rpms <path>. Unlike rpm, the build command looks for the SPEC file in the source directory. To build wget anew (like in the above example) with the DVD mounted in the system under /media/dvd, use the following commands as root:
cd /usr/src/packages/SOURCES/
mv ../SPECS/wget.spec .
build --rpms /media/dvd/suse/ wget.spec
Subsequently, a minimum environment will be established at /var/tmp/build-root. The package will be built in this environment. Upon completion, the resulting packages are located in /var/tmp/build-root/usr/src/packages/RPMS.
The build script offers a number of additional options. For example, cause the script to prefer your own RPMs, omit the initialization of the build environment, or limit the rpm command to one of the above-mentioned stages. Access additional information can be accessed with build --help and man build.

2.3.7. Tools for RPM Archives and the RPM Database

Midnight Commander (mc) can display the contents of RPM archives and copy parts of them. It represents archives as virtual file systems, offering all usual menu options of Midnight Commander: the HEADER information can be displayed with F3, the archive structure can be viewed with the cursor keys and Enter, and archive components can be copied with F5.
A front-end for rpm is also available for Emacs. KDE™ offers the kpackage tool. GNOME™ offers gnorpm.
Using the Alien (alien) Perl script, it is possible to convert or install an alien binary package. This tries to convert old TGZ archives to RPM before installing. This way, the RPM database can keep track of such a package after it has been installed. Beware: alien is still alpha software, according to its author — even if it already has a high version number.


Popular Posts

 

Copyright @ 2013 Best blogg.

Designed by Templateify & Sponsored By Twigplay