Category Archives: Unix Administration

Passwordless login remote with SSH

generate the public keys

user1@server1> ssh-keygen –t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
31:a1:c2:d7:a6:9f:27:cd:84:1f:f2:7a:e8:7c:34:80

user1@server1> cd /home/user1/.ssh
user1@server1> cp id_rsa.pub authorized_keys

Copy the file authorized_keys to server2 and it is now possible to login without password.

user1@server1> cd /home/user1/.ssh
user1@server1> scp authorized_keys server2:/home/user1/.ssh

How To Make RPM Packages

When working with RedHat Linux systems the best way to ensure that you have the right software installed is by using RPM’s

RPM is a package management system like Solaris packages.

To create packages from source code some or all of the following steps would be needed.

To set it up a build environment and number of configuration files are needed.

First the build environment.

cd /home/asbjorn
mkdir myrpm
cd rpm
mkdir -p BUILD RPMS/i386 SOURCES SPECS SRPMS

In earlier releases of RedHat a file .rpmrc was used.

Now rpmbuild uses the .rpmmacros for default values.

In the first two lines, information about the package creator is provided.

The _topdir line is included, so the package can be build as a user rather than as root.
Do not build packages as root if you can avoid it.

The following lines provide references to the build environment.

cd /home/asbjorn

vi .rpmmacros

%packager      Asbjorn Riedel <asbjorn@SOMEWEBSITE.com>
%vendor        The name of the project

%_topdir       /home/asbjorn/myrpm

%{_topdir}/BUILD
%{_topdir}/RPMS
%{_topdir}/RPMS/i386
%{_topdir}/SOURCES
%{_topdir}/SPECS
%{_topdir}/SRPMS

By defining the .spec file we can set up all the parameters needed for building packages of software delivered as tar files.

The %{_prefix} definition can be changed depending on the location where you want your package to be installed, example /opt, /usr or /usr/local. Just change the line with Prefix:  in it.

 vi myrpm/SPECS/testpackage.spec

%define name testpackage
%define version 0.0.1
%define release 1

Summary: A test package for RedHat Linux
Name: %{name}
Version: %{version}
Release: %{release}
Source:
http://www.picourl.com/testpackage/%{name}-%{version}.tar.gz
Vendor: Guess It Must Be Me
URL:
http://www.picourl.com/
License: None
Group: System
Prefix: %{_prefix}

%description
This is a testpackage , specially made for testing

%package devel
Summary: package with stuff to develop %{name}.
Group: System
Requires: %{name} = %{version}

%description devel
The %{name}-devel testpackage contains stuff for building %{name}.

%prep
%setup -q

%build
make

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc ReadMe
%{_prefix}/lib/lib*.so.*

%files devel
%defattr(-,root,root)
%doc ReadMe
%{_prefix}/bin/*
%{_prefix}/include/*

%changelog
* Thu Mar 27 2008 Asbjorn Riedel <
asbjorn@localhost>
- Initial spec file

The %install part contains the actual commands to build the software and it may need to be changed in your case.

 

How to finally do the build …

rpmbuild -ba SPECS/testpackage.specs