mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2004-01-02, 16:17   #1
gbvalor
 
gbvalor's Avatar
 
Aug 2002

11110 Posts
Default mprime RPM package for linux

Hello,

As an exercise of my RPM doc reading, I've finally build an mprime RPM package for SuSE >= 8.2. I have not tried on Red-Hat. You can download both the source-RPM (precompiled) and the binary one from the directory

http://www.oxixares.com/rpms/SuSE_8.2/

Of course, It is built using the precompiled binary and files supplied in mprime235.tar.gz, plus some small files and scripts. Any comment or suggestion is welcome.

It is build as a service, so it starts at boot time following the system V and LSB (Linux Standard Base) method. This is the README_OR_DIE file:

Quote:
This is a short descripition of what to do when installing mprime RPM.

A) If you already have a previous mprime running. As root:
A.1) Stop the run of mprime
A.2) Copy the old working directory to /etc/prime directory. Something like
#cd /my/current/working/mprime/directory
#cp -pr * /opt/prime
A.3) re-install the RPM package (it will kill older version of
mprime binary). As example:
#cd /where/the/rpm/is/downloaded
#rpm --force -Uvh mprime-23.5-2.i586.rpm
A.4) Start mprime as service
#rcprime start

B) If Is the first time you run/install mprime. As root:
B.1) Read carefully the file /usr/share/doc/packages/mprime/readme.txt
B.2) Run the setup script
#primesetup
You can follow diferent menus. Set your Choices. Don't start
any run/work yet, only set your preferences and perhaps send
them to primenet server.
B.3) When exit from setup, then init the prime service
#rcprime start

To see latest mprime output:

> primelist [n]

n is optional and is the number of lines to be displayed. You don't
need to have root privileges to run primelist

About the rcprime script (you need to be root):

#rcprime start -> Start the prime service
stop -> Stop the prime service
restart -> Restart the prime service
status -> Show the status of prime service
Well, sure the RPM could be a lot better, but it is a starting point. I'm using this mprime/service scheme since two years ago and I've hadn't any problem up to now.

I think it is good to do the instalation easy to linux users. Similar RPMS could be built for Glucas and Mlucas.

Have a nice start of 2004.

Guillermo.
gbvalor is offline   Reply With Quote
Old 2004-01-03, 08:17   #2
GP2
 
GP2's Avatar
 
Sep 2003

29·89 Posts
Default

Guillermo,

I was also thinking about an RPM for Red Hat. When I saw your thread here, I cleaned it up a bit today and uploaded it.

The RPM is here:
http://opteron.mersenneforum.org/RPM...3.5-1.i386.rpm

The source RPM is here:
http://opteron.mersenneforum.org/SRP...23.5-1.src.rpm


mprime runs as a daemon under the unprivileged user "mersenne", which is created (httpd does something similar with user "apache").

The usual daemon commands are available:

/etc/rc.d/init.d/mprimed start
/etc/rc.d/init.d/mprimed stop
/etc/rc.d/init.d/mprimed restart
/etc/rc.d/init.d/mprimed status # shows savefile iteration!

However, there is also
/etc/rc.d/init/mprimed config # to run menus -m
/etc/rc.d/init/mprimed manualstart # to run as non-daemon, displaying -d in the current window

BUGS:
- It needs a man page
- I can't test SMP. If it worked it would be run as:
/etc/rc.d/init.d/mprimed start 2 # runs with -B2 , see readme.txt

By modifying the source RPM, and using conditional statements, it should be possible to make it work for other distributions other than Red Hat.

By the way, there is a useful book which I think I'll be buying:
Red Hat RPM Guide

Comments or feedback welcome.
GP2 is offline   Reply With Quote
Old 2004-01-03, 08:54   #3
gbvalor
 
gbvalor's Avatar
 
Aug 2002

3·37 Posts
Default

Quote:
mprime runs as a daemon under the unprivileged user "mersenne", which is created (httpd does something similar with user "apache").
You're right! And it is more safe.

Well, it seems like we both were thinking almost the same. I think there will be more convenient to use the same spec file, if possible, with the aim to unify the RPMS. I also wrote some specs (for other packages) with some lines to detect the distribution and version. May be we can use it.

You can reach me directly at gbv at oxixares dot com.

Guillermo
gbvalor is offline   Reply With Quote
Old 2004-01-03, 10:52   #4
gbvalor
 
gbvalor's Avatar
 
Aug 2002

1578 Posts
Default

Hi,

I read GP2 spec file and mprime.init daemon. It will not be easy to merge the RPMS.

Anyway, we must to merge in the the following things:

1) The directory of mprime, where save files, results, and output list are. I used '/opt/prime'. I also left the binary mprime there because of some problems when output the 'iter.log' file. I think GP2 use '/var/mprime'. This time I like '/opt/prime' a bit much.

2) The doc directory: i.e., all the *.txt and all README and docs files we could write in a future. SuSE installs all the doc files in '/usr/share/doc/packages/name_of_package' directory. May be Red Hat also installs the doc files in a predefined directory, but I think it is different than SuSE. I guess that the predefined macro %doc does the job here.

3) The name of daemon. It could be mprimed or rcprime. No problem, we can made a soft link to call it. I saw a bit more elaborate status item in GP2 RPM. I could borrow part of it . Adding some commnon options would be no major problem too. In my rcscript, mprime append the verbose output to 'iter.log' file. I think it is useful enough.

4) The name of deamon user. 'mersenne' is a nice user. What about the group?. Must we use predefined user ID < 100?

5) Where to upload and how we should name the rpms. (suited for different distributions).

6) the man pages

On the other hand, I also have to add possible SMP support a few more small details.

Guillermo
gbvalor is offline   Reply With Quote
Old 2004-01-03, 12:06   #5
GP2
 
GP2's Avatar
 
Sep 2003

29·89 Posts
Default

Quote:
Originally posted by gbvalor
1) The directory of mprime, where save files, results, and output list are. I used '/opt/prime'.
I didn't explicitly use /var, rather the source RPM just uses %{_localstatedir}, which is defined in /usr/lib/rpm/macros. Red Hat doesn't have an /opt directory. If SuSE uses /opt, then it must be defined in a similar RPM configuration file. So hopefully we could use the same source RPM, and the binary RPMs for Red Hat and Linux might be different.

I don't agree that the mprime executable should go into /var/mprime... it should go into a global system bin directory and use the -W flag to find its working directory.

Quote:

2) The doc directory: i.e., all the *.txt and all README and docs files we could write in a future. SuSE installs all the doc files in '/usr/share/doc/packages/name_of_package' directory. May be Red Hat also installs the doc files in a predefined directory, but I think it is different than SuSE. I guess that the predefined macro %doc does the job here.
Yes, Red Hat uses something similar: /usr/share/doc/name_of_package/
I used %doc at first, but then commented it out, and put all those documentation .txt files in the same directory, because that's where longtime mprime users expect to find them. On the other hand, %doc follows Linux standards much more closely. We could go with that, and maybe put symbolic links in the /var/mprime directory pointing to /usr/share/doc/mprime/

Quote:

3) The name of daemon. It could be mprimed or rcprime. No problem, we can made a soft link to call it.
In Red Hat, daemons tend to be named mysqld, httpd, etc. Does SuSE have an "rc" naming convention? I'm sure we could just put some conditional logic into the source RPM and use the same source RPM to build different binary RPMs for Red Hat and SuSE.

Quote:

4) The name of deamon user. 'mersenne' is a nice user. What about the group?. Must we use predefined user ID < 100?
I chose 'mersenne' for the user rather than 'mprime', so that it could be reused for all GIMPS programs (mprime, Glucas, etc). In Red Hat, by default, the user names and group names are always the same. The useradd command creates the group at the same time as it creates the user. We should not use a specific system user ID < 100 because there's no way to avoid conflicts with the operating system.

Quote:

5) Where to upload and how we should name the rpms. (suited for different distributions).
The binary RPM names will be the same (mprime-23.5-n.i386.rpm), but we can have separate subdirectories for SuSE and Red Hat. Hopefully, there will only be one source RPM.

Quote:

6) the man pages
Doesn't have to be anything elaborate, just a pointer to the real documentation at /usr/share/doc.
GP2 is offline   Reply With Quote
Old 2004-01-03, 12:41   #6
aaronl
 
aaronl's Avatar
 
Aug 2003

24·3 Posts
Default

Quote:
Originally posted by GP2

- I can't test SMP. If it worked it would be run as:
/etc/rc.d/init.d/mprimed start 2 # runs with -B2 , see readme.txt
I don't use RedHat (in fact I'm a Debian developer) but it seems wrong for an init.d script to take options. Does RH have /etc/defaults? That's where we store options for init scripts.
aaronl is offline   Reply With Quote
Old 2004-01-03, 17:28   #7
GP2
 
GP2's Avatar
 
Sep 2003

29·89 Posts
Default

Quote:
Originally posted by aaronl
I don't use RedHat (in fact I'm a Debian developer) but it seems wrong for an init.d script to take options. Does RH have /etc/defaults? That's where we store options for init scripts.
For running it manually for testing purposes, it's not a problem.

Obviously for automatic startup at reboot time, it's not possible to specify an argument.

It's possible to specify a default for shell functions arguments via the ${1:-2} syntax. You're right that it needs to be settable via some config file... or maybe we can automatically read how many CPUs the box has.
GP2 is offline   Reply With Quote
Old 2004-01-03, 20:26   #8
gbvalor
 
gbvalor's Avatar
 
Aug 2002

1578 Posts
Default

A line like

%define _suse %(if [ -e /etc/SuSE-release ]; then echo 1; else echo 0; fi)

works for me to detect SuSE distribution. Is there an /etc/RedHat-release file on Red-Hat?

Quote:
I didn't explicitly use /var, rather the source RPM just uses %{_localstatedir}, which is defined in /usr/lib/rpm/macros. Red Hat doesn't have an /opt directory. If SuSE uses /opt, then it must be defined in a similar RPM configuration file. So hopefully we could use the same source RPM, and the binary RPMs for Red Hat and Linux might be different.
On SuSE %{_localstatedir} is '/usr/var' by default. Well, why we don't define 'mprimehome' as '%{_localstatedir}/mprime' . Then our init scripts will point to that directory as working -W directory.

Using %if , we could rename mprimed.init.suse to mprimed if suse, and mprimed.init.redhat to mprimed.init if redhat.

We also should direct the mprime output to /var/log/mprime.log and write a mprime.logrotate as I saw commented in GP2 spec file.

Quote:
On the other hand, %doc follows Linux standards much more closely. We could go with that, and maybe put symbolic links in the /var/mprime directory pointing to /usr/share/doc/mprime/
Agreed. I'll do that

Quote:
I chose 'mersenne' for the user rather than 'mprime', so that it could be reused for all GIMPS programs (mprime, Glucas, etc). In Red Hat, by default, the user names and group names are always the same. The useradd command creates the group at the same time as it creates the user. We should not use a specific system user ID < 100 because there's no way to avoid conflicts with the operating system.
OK, using %if I will add also a group 'mersenne' . I don't know whether the defaults in SuSE is that the group name is the same than user name.

Quote:
The binary RPM names will be the same (mprime-23.5-n.i386.rpm), but we can have separate subdirectories for SuSE and Red Hat. Hopefully, there will only be one source RPM.
OK. Then, it seems GP2 is the person to upload the rpms (and merge spec files). GP2, could you send me an email link to send you my spec files drafts and
binary RPMS for SuSE?.

This weekend I'll try to write a first draft of a merged mprime.spec file based on GP2 one.

Guillermo.
gbvalor is offline   Reply With Quote
Old 2004-01-03, 22:15   #9
GP2
 
GP2's Avatar
 
Sep 2003

29×89 Posts
Default

Quote:
Originally posted by gbvalor
Is there an /etc/RedHat-release file on Red-Hat?
Yes, it's called /etc/redhat-release

Quote:

Well, why we don't define 'mprimehome' as '%{_localstatedir}/mprime' . Then our init scripts will point to that directory as working -W directory.
Yes, I think this is what I'm doing already.

Quote:

We also should direct the mprime output to /var/log/mprime.log and write a mprime.logrotate as I saw commented in GP2 spec file.
Originally I thought of putting prime.log into /var/log/mprime, but decided against it because stuff in it gets deleted (logrotated) after four weeks. So I commented that out. But if you want to sent the output of mprime -d into a /var/log logfile (instead of just sending it to /dev/null) and then logrotating that, that's not a bad idea.
GP2 is offline   Reply With Quote
Old 2004-01-03, 22:23   #10
GP2
 
GP2's Avatar
 
Sep 2003

258110 Posts
Default

Quote:
Originally posted by aaronl
I don't use RedHat (in fact I'm a Debian developer) but it seems wrong for an init.d script to take options. Does RH have /etc/defaults? That's where we store options for init scripts.
Wasn't there a Debian package for mprime at one time? Is it still maintained and up-to-date? If you're a Debian developer, could you look into it? Or can Debian use RPMs seamlessly now?
GP2 is offline   Reply With Quote
Old 2004-01-03, 23:43   #11
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

22·41·47 Posts
Default

Quote:
Originally posted by GP2
Wasn't there a Debian package for mprime at one time?
http://fgouget.free.fr/distributed/prime-net-en.shtml
Xyzzy is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing mprime on Linux lidocorc Software 9 2009-11-06 20:59
mprime and linux Echoblade Information & Answers 3 2007-06-24 22:28
Debian package of mprime Matt Linux 1 2007-02-22 22:36
Instructions for using Mprime under Linux tha Software 7 2004-01-12 18:45
MPrime on Linux optim Software 13 2003-12-06 04:27

All times are UTC. The time now is 09:00.

Thu Oct 29 09:00:08 UTC 2020 up 49 days, 6:11, 1 user, load averages: 1.84, 1.71, 1.60

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.