SUSE chkconfig --add no longer works - linux

I maintain a package that runs some services for datalogger communication. I am getting complaints that these services are not running after the package is installed in the latest version of opensuse. Currently, my postinst script for the package looks like the following:
/sbin/chkconfig --add csilgrnet
/sbin/service csilgrnet start
This, of course is executed by the package manager after the csilgrnet file has been added to /etc/init.d
Looking at the /etc/init.d directory, the only service scripts that I see there are the ones placed there by my package. I don't see the scripts there for any other packages or parts of the distribution. It would thus appear to me that the way that daemon startup scripts ways are managed has changed but I am clueless about the alternative.

Related

Installing Tomcat as different user using yum

I'm installing tomcat using yum package manager, but I want to run the service under different user (not tomcat).
Is there an easy way to do that on installation or am I always forced to change owner of all directories, service etc.?
If tomcat is managed by systemd, you can add a custom file /etc/systemd/system/tomcat.service.d/custom-user.conf containing just the following lines
[Service]
User=myUser
For older OSes you should be able to do it by setting the TOMCAT_USER variable in /etc/sysconfig/tomcat.
This is an extra configuration of course. It's not possible to modify a rpm-provided configuration file without rebuilding the rpm. If you have an internal yum repository you can build a rpm package providing this file but I think the easier way is using a configuration management tool like ansible or saltstack.

Does the Docker RPM require additional dependencies?

I couldn't find an answer online, help would be appreciated.
I have downloaded the Docker RPM for CentOS 7 from their site (http://docs.docker.com/v1.7/docker/installation/centos).
After installing the RPM, does Docker require any additional dependencies in order to run? Or is the standalone RPM enough?
I'm asking because it takes time to bring external files into my company's network. So I'd like to know in advance all of the dependencies (RPMs or other files) I need to bring into the network, along with the Docker RPM, so I can do it all at once.
It has a lot of dependencies.
You can use a tool call repotrack to download the Docker Engine RPM and all of it's dependencies.
repotrack docker-engine
There's a similar tool out there called yumdownloader, it won't work for your use case because it only downloads the rpms needed for the specific Centos/RHEL server that you run the command on. Repotrack downloads all, not taking into account what is already installed on the system.

Yum/apt-get before cpan to manage UNIX system-wide Perl modules?

Perl's cpan command is a powerful way to manage Perl modules. However, when maintaining modules system-wide under UNIX, Michal Ingeli notes that another possible option is
yum install 'perl(PerlModuleName)'. If available, should yum be my first resort in this case?
For example, the command cpanm CGI installs the CGI module under my ~/perl5 directory, which may be best if the CGI module is only needed by scripts run under my account. But this won't provide the CGI module to scripts run by other accounts.
I can use cpanm -l <directory> to force the cpanm command to load modules to a specific directory (e.g., cpanm -l /usr/local CGI to install CGI to /usr/local/lib/perl5), or I can edit ~/cpan/CPAN/MyConfig.pm to change the default install location cpan uses.
But on nearly all systems, multiple Perl system library locations exist (/usr/local/share/perl5, /usr/share/perl5/vendor_perl, /usr/lib64/perl5, etc.), and choosing the correct one is somewhat arbitrary since these are not generated by the cpan command.
With this in mind, should I turn to yum (if available) before cpan for system-wide UNIX Perl module management? It's easy enough to test with a command like:
yum install 'perl(LWP::Simple)'
If yum failed in this instance, I would fall back to:
cpanm -l <directory> LWP::Simple
What do you recommend in this type of case, and why?
(Note that nxadm has answered a more general question about this.)
To summarize answers so far:
If at all possible, use the system package manager to update CPAN modules. E.g., for LWP::Simple:
yum install 'perl(LWP::Simple)', or
apt-get install liblwp-simple-perl
If the preceding fails, try to implement a separate Perl environment in which to use CPAN modules not present in the system-wide libraries. Consider local::lib or Perlbrew for this;
Only if the above options don't apply, use cpanm -l <directory> to load the module to a system-wide directory.
I can't speak from experience with RPM/yum systems, but I have done a lot of work with Perl applications on Debian systems and I do highly recommend going with the system packaged versions of CPAN modules if you can. I know a lot of people disagree and historically they may have had good reason but I've been doing it for a long time and find it works very well.
In the Debian world there are an enormous number of Perl modules in pre-packaged form and if you happen to need one that isn't packaged you can build your own package with dh-make-perl and put it in your local apt repository. Being able to run apt-get install your-application and have it pull in all the required dependencies is a real time saver when your code is moving through Dev -> Staging/UAT -> Production workflows. It also gives you confidence that the version of a particular module you're deploying to production is the same as the one you tested in UAT.
One thing you absolutely should not do is use cpanm or the cpan shell as root to install modules into the system directories. If you decide to install direct from CPAN, then use local::lib to install the modules in an application-specific lib directory.
[Edit] Some sample commands as requested:
On a Debian-based system, you would first install the dh-make-perl tool:
sudo apt-get-install dh-make-perl
Then to download a package from CPAN and build it into a .deb file you would run a command like this*:
dh-make-perl --build --cpan Algorithm::CouponCode
You could install the resulting .deb file with:
sudo dpkg -i libalgorithm-couponcode-perl_1.005-1_all.deb
Managing your own apt repository is a whole other topic. In my case I'd copy the .deb to an appropriate directory on the local apt server and run a script to update the index (I think our script uses dpkg-scanpackages).
Note in my opening paragraph above I recommend using systems packages "if you can". To be clear, I meant in the case where most of the modules you want are already packaged by Debain. The example above did not build packages for any dependencies. If your app involves installing modules which have long dependency chains that are not in Debian already, then using cpanm and local::lib will simplify the install. But then you shoulder the burden of repeating that as your code advances through staging to production servers. And you may need to use cpanfile or carton to make sure you're getting the same versions at each step.
* one gotcha: if you have previously set up local::lib so that cpan installs go into a private directory (e.g.: /home/user/perl5) then that will affect the pathnames used in the .deb produced by dh-make-perl. To avoid that, run this before dh-make-perl:
unset PERL5LIB PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT
Your system's perl was put there for your system's use. The folks that maintain your distribution will update it when they see fit to another version that suits the needs of your system. Using your system's Package Manager to manage it is really your best idea.
Feel free to use it, but if you need a different version, for whatever reason, you are best rolling your own into a separate location. When maintaining your own perl install, use CPAN.

How do I package an application for ubuntu apt-get?

I want to host an apt-get repository.
How do I package my application, and how do I host it in a repository for use?
The application relies on Java, MySQL, upstart and is configured to run on boot as an upstart service.
The answer should also include, how to host the package on a repository.
Ref:
How do I package a Java program for Ubuntu?
How do I package Mono applications for Debian/Ubuntu
Packaging for Ubuntu - Web Application
Good question, maybe a personal ppa is what you are looking for. After you finish you will have to do a $ sudo add-apt-repository ppa:myApp/ppa. Then you can apt-get install it.
To package your application you will need to do this in your apps directory
myappFolder$ dh_make -p myApp_1.0 --createorig
To create a original tar of your app. This will also create a Debian folder with a control file, a rules file, changelog... Change the values in these files to fit how your package should be. Specifically the control file. You will have a Depends: field where you can write in packages your application relies on such as Java and MySQL, make sure to have the same names as Ubuntu repository for these things.
goodLink https://www.debian.org/doc/manuals/maint-guide/dreq.en.html
Check out chapter 5 the install file and then building the package in chapter 6. I use dpkg-buildpackage usually. debuild -us -uc is good too look up too.
Then create an account on Ubuntu launchpad.
https://login.launchpad.net/+new_account
Sign the Ubuntu code of conduct:
https://launchpad.net/codeofconduct (take away the extra h, no reputation for more links)
Activate a PPA:
https://launchpad.net/people/+me/ (extra h)
Then follow this guide to upload the package to your ppa:
https://help.launchpad.net/Packaging/PPA/Uploading (extra h)
I got these links from a great answer on ask.ubuntu. It's also got a more lengthy answer on creating a deb package.
https://askubuntu.com/questions/71510/how-do-i-create-a-ppa

RCP P2 updates in multi-user environment from read-only installation

I have created an Ubuntu package to install my RCP app. The installed files are owned by root. Is it possible for a user to subsequently install updates through P2? Documentation about Eclipse multi-user installs suggests that it is possible, along with the answer to this question.
However, when I start up the application, it does not automatically check for updates as usual, and the Update Site that I had specified in p2.inf is not listed in the "Install New Software..." dialog.
Using the -configuration or -data runtime options did not help.
I can make it work with a hack by running sudo chown -R <my_username> /opt/<my_app_installation>. When I subsequently launch the application, it does properly check for updates on startup, and my update site is properly listed in the "Install New Software..." dialog. Certainly I would prefer that whatever data it is writing to that installation directory be instead written to the user's home directory.
Supplementary info:
Here is a list of files and folders that showed up in my installation directory only after the directory was given ownership by <my_username> and the program was run.
/opt/<my_app_installation>/configuration/org.eclipse.core.runtime
/opt/<my_app_installation>/configuration/org.eclipse.equinox.app
/opt/<my_app_installation>/configuration/org.eclipse.osgi
/opt/<my_app_installation>/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/1339896994308.profile.gz
/opt/<my_app_installation>/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.prefs
/opt/<my_app_installation>/p2/org.eclipse.equinox.p2.engine/profileRegistry/profile.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.scheduler.prefs
/opt/<my_app_installation>/p2/org.eclipse.equinox.p2.repository
More experimental results:
Even with a writable (chown'd) installation directory, no files are placed there when the
-configuration $HOME/.my_app_files runtime option is supplied.
There are lots of limitation of p2 itself for share install. AFAIK there is no significant improvement in latest release Juno as well.
But a guy from Redhat is working on p2 install with RPM package, you can read his progress in his blog post. The work and idea could be shared with Debian package.

Resources