Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Tip: A virtual package to do my basic setup

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
14 posts • Page 1 of 1
Author
Message
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

Tip: A virtual package to do my basic setup

  • Quote

Post by ToeiRei » Wed Feb 29, 2012 12:12 pm

Motivation:
When I had to install a few gentoo boxes in a row, I was looking for a simple way to install a basic set of packages and came up with this approach, using a virtual package pulling in the packages I wanted.

First approach:
The easiest thing is an ebuild, named virtual/myprefpack-0.ebuild, being a virtual package pulling in my stuff as RDEPEND:

Code: Select all

DESCRIPTION="Virtual for pulling in my default packages"
HOMEPAGE=""
SRC_URI=""

LICENSE=""
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"

DEPEND=""
RDEPEND="
        app-admin/rsyslog
        app-portage/gentoolkit
        app-portage/layman
"
My actual RDEPEND list is bigger than the example listed here, as I want to keep them short for the example.

Adding some jobs and a reminder:
Now as we are lazy, we could perform basic things like updating the mlocate database and remind us of some stuff we shouldn't forget. I did it using einfo/elog messages in pkg_postinst()

Code: Select all

pkg_postinst() {
        einfo "Updating mlocate database...";
        updatedb

        echo -e "\n\n\n"

        elog "********************************************************************"
        elog "Do not forget to:"
        elog "   - add the startup scripts to the runlevels"
        elog "********************************************************************"

}

Introducing USE-Flags for different machine types:
What we did so far was pulling in our packages and running an easy batch job and giving some useful messages. Looking at my systems here, I can sort them into 3 groups: generic clients, generic servers and machines having a the linux/apache/mysql/php stack on them. Introducing USE flags for doing that is pretty simple.

My definition of a pure server machine (USE='server') is, that it's powered on 24/7 while clients are turned off at times, which is why I use vixie-cron there, while using fcron on clients. Servers which are switched off as clients may have both flags set, so I am using a little exclude here:

Code: Select all

DESCRIPTION="Virtual for pulling in my default packages"
HOMEPAGE=""
SRC_URI=""

LICENSE=""
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
IUSE="client lamp server"

DEPEND=""
RDEPEND="
        app-admin/rsyslog
        app-portage/gentoolkit
        app-portage/layman
        client? (
                media-sound/alsa-utils
                net-irc/irssi
                net-misc/keychain
                sys-process/fcron
        )
        lamp? (
                dev-db/phpmyadmin
                dev-lang/php
                www-servers/apache
        )
        server? (
                app-admin/logrotate
                app-misc/screen
                net-misc/ntp
                sys-fs/xfsdump
                sys-fs/xfsprogs
                !client? (
                        sys-process/vixie-cron
                        mail-mta/ssmtp
                        )
                )"

And for our reminder in pkg_postinst(), we can do it that way:

Code: Select all

 elog "   - add the startup scripts to the runlevels"

        if use server ; then
                elog "   - set up ssmtp"
                elog "   - set up rkhunter"
        fi
I am sure there are better ways to do this, but this one seems to be an easy one which worked for me ;)
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
j4miel
n00b
n00b
Posts: 58
Joined: Mon Sep 26, 2005 5:41 pm

  • Quote

Post by j4miel » Wed Feb 29, 2012 2:45 pm

Nice idea, do you manually configure from this point or do you have an easy way to patch configs to your liking?
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Wed Feb 29, 2012 2:53 pm

My current config files are fetched from a git repository which could be implemented in pkg_postinstall(), as sandbox isn't interfering there anymore. Sadly this does not honor CONFIG_PROTECT
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
avx
Advocate
Advocate
User avatar
Posts: 2152
Joined: Mon Jun 21, 2004 4:06 am

  • Quote

Post by avx » Wed Feb 29, 2012 9:43 pm

interesting, thanks. i'd add support for adding required users, setting up services, maybe backups, etc. in theory, could be a nice way to have a simple thing like redhat's kickstart.
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Top
xaviermiller
Bodhisattva
Bodhisattva
User avatar
Posts: 8740
Joined: Fri Jul 23, 2004 6:49 pm
Location: ~Brussels - Belgique
Contact:
Contact xaviermiller
Website

  • Quote

Post by xaviermiller » Wed Feb 29, 2012 10:01 pm

Nice idea ! 8)

For the moment, I reinstall using something like

Code: Select all

scp workingmachine:/var/lib/portage/wold todo
$EDITOR todo
emerge -av $(cat todo)
Your trick is more scalable and parametrable.
Kind regards,
Xavier Miller
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Thu Mar 01, 2012 7:07 am

avx wrote:interesting, thanks. i'd add support for adding required users, setting up services, maybe backups, etc. in theory, could be a nice way to have a simple thing like redhat's kickstart.
adding users is possible - even if I would consider that as a waste sometimes:

Code: Select all

enewuser <user> [uid] [shell] [homedir] [groups] [params]
but due to the nature of ebuilds, I wouldn't add service stuff as they can be emerged more than once. Backups could be handled via /etc/cron.daily.
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
avx
Advocate
Advocate
User avatar
Posts: 2152
Joined: Mon Jun 21, 2004 4:06 am

  • Quote

Post by avx » Thu Mar 01, 2012 10:10 am

Why'd you consider it as a waste? I mean to do it in a dynamic way, ie have some loop-function with a custom variable, so one could do something like

Code: Select all

CREATE_USERS="foo bar baz" emerge my_setup
.
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Thu Mar 01, 2012 8:49 pm

Keep in mind that this setup isn't just for 1 box. You don't want to have too many user accounts around. If you are in a bigger network, you might already use LDAP
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
face
n00b
n00b
Posts: 12
Joined: Sat Mar 20, 2004 1:34 am

  • Quote

Post by face » Sat Mar 10, 2012 10:52 am

puppet could be an alternative to this approach.
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Sat Mar 10, 2012 12:18 pm

but why using additional software?
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
face
n00b
n00b
Posts: 12
Joined: Sat Mar 20, 2004 1:34 am

  • Quote

Post by face » Mon Mar 12, 2012 7:24 am

convenience ;-)

Its way easier to configure a system with puppet than with portage only. portage is primarily a package manager.
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Mon Mar 12, 2012 8:05 am

Not sure if you got the idea here, as it's about providing a basic install using onboard tools as much as possible. I don't see the need of depending on a greater infrastructure here for 'home use' or 'small business' - sure, your toy might come in handy as soon as the number of machines you have to maintain exceeds 10 boxes...
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
yngwin
Retired Dev
Retired Dev
User avatar
Posts: 4572
Joined: Thu Dec 19, 2002 1:22 pm
Location: Suzhou, China

  • Quote

Post by yngwin » Mon Mar 12, 2012 11:11 am

This is what sets are for, though I think that requires portage-2.2.
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Mon Mar 12, 2012 11:36 am

I disagree with that sets would be sufficient for a 'basic setup task' as you cannot add users using sets or performing other scripted tasks like I do using the example.
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
Post Reply

14 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. and of Förderverein Gentoo e.V.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license.
The Gentoo Name and Logo Usage Guidelines apply.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy