Difference between revisions of "Package:Webmin"

From Funtoo
Jump to navigation Jump to search
m (typo)
(Added OpenRC script to enable package to be controlled by openrc)
Line 34: Line 34:


As above, start Webmin manually then ensure it does so from boot.
As above, start Webmin manually then ensure it does so from boot.
By default, when Webmin is installed directly from source, OpenRC doesn't know about it and thus, cannot control it. By adding a openrc boot-script to /etc/init.d/ openrc regains control over Webmin.
Create a text file, named webmin, then copy the following:
<nowiki>
#!/sbin/openrc-run
#depend () {
# perl
#}
start() {
echo Starting Webmin server in /etc/webmin
trap '' 1
LANG=
export LANG
#PERLIO=:raw
unset PERLIO
export PERLIO
PERLLIB=/etc/webmin
export PERLLIB
exec '/etc/webmin/miniserv.pl' $* /etc/webmin/miniserv.conf
}
restart() {
/etc/webmin/stop --kill && /etc/webmin/start
}
stop() {
echo Stopping Webmin server in /etc/webmin
pidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g'`
pid=`cat $pidfile`
if [ "$pid" != "" ]; then
  kill $pid || exit 1
  touch /var/webmin/stop-flag
  if [ "$1" = "--kill" ]; then
    sleep 2
    (kill -9 -- -$pid || kill -9 $pid) 2>/dev/null
  fi
  exit 0
else
  exit 1
fi
}
</nowiki>
Save the file. Copy or move the file to /etc/init.d/ then make it executable:
{{console|body=
# cp webmin /etc/init.d/
# chmod +x /etc/ini.d/webmin
}}
Next step is to add the service webmin to openrc:
{{console|body=
# rc-update add webmin default
}}
Now Webmin starts at boot, directly via OpenRC.


=== Troubleshooting ===
=== Troubleshooting ===

Revision as of 00:17, February 27, 2021

Webmin

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Webmin is a web-based interface for system administration on Unix and Linux systems.

Prerequisites

Webmin uses Perl, so

root # emerge perl

Installation

There are 2 methods of installing Webmin on your Funtoo server: emerging it from the Gentoo ebuild or manual installation. By default Webmin installs itself in /etc/webmin.

Ebuild

Gentoo has version 1.730 in the repository so installing that is fairly straightforward:

root # emerge webmin

After installation Webmin needs to be started manually with the following command:

root # sh ./etc/webmin/start

Next, start a browser and go to the Webmin page at https://localhost:10000 if you accepted all default settings. Go to the Webmin configuration pages in the menu and tell Webmin to start at boot. Make sure you save the new settings!

Manual Installation

Although the 1.730 version offered by the Gentoo ebuild will suffice for most users, it does keeps nagging about a newer version available. Manually installing from the source tar ball resolves that, at least until the next release. ;-) Webmin has documented the process on their own wiki: http://doxfer.webmin.com/Webmin/Installation_-_the_old_fashioned_way

As above, start Webmin manually then ensure it does so from boot.

By default, when Webmin is installed directly from source, OpenRC doesn't know about it and thus, cannot control it. By adding a openrc boot-script to /etc/init.d/ openrc regains control over Webmin.

Create a text file, named webmin, then copy the following:

#!/sbin/openrc-run

#depend () {
#	perl
#}

start() {
	echo Starting Webmin server in /etc/webmin
	trap '' 1
	LANG=
	export LANG
	#PERLIO=:raw
	unset PERLIO
	export PERLIO
	PERLLIB=/etc/webmin
	export PERLLIB
	exec '/etc/webmin/miniserv.pl' $* /etc/webmin/miniserv.conf
}

restart() {
	/etc/webmin/stop --kill && /etc/webmin/start
}

stop() {
	echo Stopping Webmin server in /etc/webmin
	pidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g'`
	pid=`cat $pidfile`
	if [ "$pid" != "" ]; then
  	kill $pid || exit 1
  	touch /var/webmin/stop-flag
  	if [ "$1" = "--kill" ]; then
    	sleep 2
    	(kill -9 -- -$pid || kill -9 $pid) 2>/dev/null
  	fi
  	exit 0
	else
  	exit 1
	fi
}


Save the file. Copy or move the file to /etc/init.d/ then make it executable:

root # cp webmin /etc/init.d/
root # chmod +x /etc/ini.d/webmin

Next step is to add the service webmin to openrc:

root # rc-update add webmin default

Now Webmin starts at boot, directly via OpenRC.

Troubleshooting

   Important

This section is in need of updates.