rpm repository: How to create a rpm package and install it to a http reachable rpm repository

Introduction

The following post will describe how a rpm repository to install packaged applications from can be configured and how the build process does work.

General

Preconditions

The documentation is written and tested for SUSE Enterprise Linux 12 (SP1) (SLES12) as build- and reposerver.

The following packages need to be installed:

  • createrepo
  • httpd
  • rpmbuild

Operation Protocol

The following steps can be performed to create a rpm repository and build an rpm package.

Access control lists

To access the logfiles of the httpd service and to be able to create the repository in the htdocs directory one will need the following access control list settings:

sudo setfacl -R -m u:user:r-X /var/log/apache2
sudo setfacl -R -m u:user:rwX /srv/www/htdocs

(r: read, w: write, x: execute, X: directory access)

Create rpm repository

We will only build packages on x86_64 architecture for SLES12. One can create additional packages for different architectures or linux derivates using the example directory structure.

mkdir -p /srv/www/htdocs/repo/SUSE/Updates/12/x86_64
createrepo /srv/www/htdocs/repo/SUSE/Updates/12/x86_64

Build rpm package

To build an example minimal rpm package for the rpm repository the following steps are needed. All steps to achieve this I did not find out myself. The source is an article of devzero2000  (http://stackoverflow.com/questions/880227/what-is-the-minimum-i-have-to-do-to-create-an-rpm-file/1165200#1165200).

Create rpm build environment

mkdir -p ~/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp}

cat <<EOF >~/.rpmmacros
%_topdir   %(echo $HOME)/rpmbuild
%_tmppath  %{_topdir}/tmp
EOF

cd ~/rpmbuild

Create a tarball of the project

This step shows how to create a tarball that consists of a war file for deployment on Apache Tomcat and a web page, because the application I tested it with has a rest backend running in a tomcat container and a Angular web app for the client side.

mkdir myapp-1.0
mkdir -p myapp-1.0/srv/www/htdocs/
mkdir -p myapp-1.0/usr/share/tomcat/webapps/

Now copy the webapp in a subfolder of the htdocs folder and the war file in the webapps directory (this is only a minimal example, in production the apache2 configuration in /etc/apache2/conf.d with an alias to some folder in /usr/share/ containing the web app should be used).

Afterwards create the tar ball and copy it to SOURCES:

tar -zcvf myapp-1.0.tar.gz myapp-1.0
cp msbs-1.0.tar.gz SOURCES/

Now create a spec file with the basic install commands:

cat <<EOF > SPECS/myapp.spec

%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress

Summary: MyApp - An example application
Name: myapp
Version: 1.0
Release: 1
License: Your license
Group: Tools
SOURCE0 : %{name}-%{version}.tar.gz
URL: https://science-site.de

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
%{summary}
%prep
%setup -q

%build
# Empty section.

%install

rm -rf %{buildroot}
mkdir -p  %{buildroot}

# in builddir
cp -a * %{buildroot}


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
# %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
/srv/*
/usr/*

%changelog
* Wed Nov 27 2016   Your Name <your@mailaddress.de> 1.0-1
- First Build
EOF

Afterwards the package can be created using the following command:

rpmbuild -ba SPECS/myapp.spec

Deploy rpm package

To deploy the created package to the repository the rpm file has to be copied and the repository has to be refreshed:

cp RPMS/x86_64/myapp-1.0-1.x86_64.rpm /srv/www/htdocs/repo/SUSE/Updates/12/x86_64
sudo createrepo --update /srv/www/htdocs/repo/SUSE/Updates/12/x86_64

Add repository on target host

The repository can now be added as source to install using zypper or yum. The following example describes the process using zypper.

cat <<EOF > /etc/zypp/repos.d/MYAPP-SLE12.repo
[MYAPP-REPO]
name=MYAPP-REPO
enabled=1
autorefresh=1
baseurl=http://hostname/repo/SUSE/Updates/12/x86_64
type=rpm-md
EOF

After refreshing the repositories the new package can be installed:

sudo zypper refresh
sudo zypper search myapp

S | Name | Summary                                                                                    | Type   
--+------+--------------------------------------------------------------------------------------------+--------
i | myapp | MyApp - An example application                                                            | package

sudo zypper install myapp

Next steps

The next steps should be to configure package dependencies for the rpm package (Tomcat and httpd), to use an Apache alias for the web app and to add an undeploy step before installing the tomcat war.

Xerox XM3-19W driver download using Windows 7/8 will cause problems

If you try to find drivers for the display Xerox XM3-19W for Windows 7 or Windows 8 using google (I searched “xerox xm3-19w driver”) you mostly will find adware and spyware from different sources. None of the sites I found had something useful to offer. Xerox does not provide any drivers as well.

I have another solution for you that will work if you use a Nvidia graphic card. I think system tools of other graphic card providers can help as well, but I tested it only with the nvidia system control center.

You can use the display with current Windows versions following the steps below. Unfortunatley the software uses german language and I could find no option to set english as default. I think you will nevertheless find the options in your own language.

1. Open the nvidia system control center using the taskbar symbol:

open_nvidia_control_center

2. Select the task “Change resolution” in the task list on the left. The display Xerox XM3-19W will be shown as “analog display device”. None of the resolutions fits to the standard resolution of the display. You have to create your own settings. To do that click on the button “Modify” below the resolutions list.

nvidia_system_settings

3. The new dialog makes it possible to create a “user definded resoultion”. Create one by clicking on the button.

nvidia_modify_resolution

4. I tried different settings. The only that worked is shown below. The resolution is set to 1440×900 and the timing option “CVT – reduced blanking” has to be used. Test the settings using the button “Test”.

xm3_19w_settings

The display now should work as expected if you select this user defined resolution for the display. As you can see a Xerox XM3-19W driver download is not necessary.

Kind regards

Oliver

Exclude websites from google search

If you want to exclude a whole website from your google search, you can achieve this by adding -site:yourwebsite.com to your search.

For example, if you want to find a download link for a software, you can exclude the website chip.de. I use this example because they began to install annoying adware with their “download manager”, that has to be used for some time now instead of a direct download of the file you want to have.

For better usability you can also save a link in your bookmarks that sums up some sites you do not want to see in your search:

https://www.google.de/?q=-site%3Achip.de%20-site%3Aanotherwebsite.com

Let me know, if you found a besser possibility that works for you.

Kind regards

Oliver

Invert two finger scrolling using Windows

Picture of a MacBook Pro. Invert two finger scrolling let Windows work like Mac OS X.

If you use Windows and Mac OS X on laptops you will know the feeling… When having worked some time on your Mac and then use the Windows machine it can drive you mad that the touchpad in Windows works differently than on your Mac.

The Windows philosophy is that the two finger gesture moves the scroll bars, so if you move your finger down the page scrolls down, too. On a Mac (or on touch devices) you move your fingers to move the content of the page, not the scrollbars. This is kind of intuitive, if you are used to it.

I cannot say which way is “better”, but I would like to use only one way on every computer. Because I spend more time using my Mac’s touchpad I decided to change my Bootcamp Windows behavior and invert two finger scrolling.

If you are interested too, you can find the best tip that I found here: http://www.howtogeek.com/57542/how-to-get-the-worst-os-x-lion-feature-in-windows-reverse-scrolling/

The title of this post is brilliant, and what they suggest to invert two finger scrolling works just fine!

Kind Regards,

Oliver

Finder alternative: muCommander

MuCommander icon - a Finder alternative

Coming from Windows and Linux before, I can never get used to the way Finder sorts items. Especially that folders are not shown at top of the list and that there is no permanent reachable address bar to type in a path, is something I don’t like personally.

Currently I am testing muCommander (http://www.mucommander.com/) as an Finder alternative, which reminds me of Total Commander under Windows. It is free of charge, licensed under GPL 3.0. In addition to everything Finder can do, you can connect FTP, HDFS, HTTP, NFS, S3, SFTP. It is a cross platform application, what is a main advantage for me, because I can get used to it way better now, using it on my Linux and Windows machines as well.

Your files are displayed in two columns showing you exactly what you need to know: filename, size, date and access rights. You can define if you want to open the last visited folder or a user defined folder when you start the application. You can control everything in the application by keyboard. For everything a short key is configured and can be customized as you like.

As it comes out muCommander as finder alternative seems ideal for me. I am confident that it will be very useful and will keep you posted if something new arrives.

Best regards,

Oliver

KeepassX 2.0-alpha4 with new fonts for PasswordFields

KeepassX_v2_by_G_rawl

KeepassX for Mac OS X has only been published in its alpha version 2.0-alpha4. For its main purpose the tool absolutely suffices. Only one little thing nerves quite much. There are some password fields that do not let you paste passwords from your clipboard. Normally you can use autotype for them, but this feature has not been released for Mac OS X yet.

So there is only one last option: Typewriting the password by making it visible in KeepassX 2.0. Now but here is the catch: KeepassX uses the font “Lucida Grande UI” for its fields, which is a beautiful font but has one main disantvantage. There is simply no way to distinguish between capital i and lower case L.

So… one afternoon I spent some time on changing the font of the password fields to Courier New. If you are interested you can download this version here:

KeePassX-2.0-alpha4-courier-new.dmg.zip

This version has been compiled for 64 bit Mac OS X architecture. If this does not fit your needs you can check out this version from my GitHub repository and compile it yourself:

https://github.com/oli-ver/keepassx

Kind regards,

Oliver