注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Funtoo Linux First Steps

From Funtoo
Revision as of 21:38, August 19, 2019 by Drobbins (talk | contribs)
Jump to navigation Jump to search
Other languages:
English • ‎Türkçe • ‎español • ‎português do Brasil • ‎中文(中国大陆)‎

If you are brand new to Gentoo Linux or Funtoo Linux, this page will help you to get familiar with your new system, and how it works.

Intro to Emerge: Installing an Editor

By default, Funtoo Linux has the nano and vi editors installed. nano is the default editor.

If you are new to Funtoo Linux, you have probably heard about emerge, the Funtoo and Gentoo Linux command for installing packages from the Portage tree. Funtoo Linux has a git-based Portage tree, which is located at /var/git/meta-repo by default. It contains scripts called ebuilds that describe how to build and install packages from source. emerge is used to run these scripts and install packages, as follows:

root # emerge vim

An important note about any commands you specify on an emerge command-line -- Portage will automatically add them to your "selected" set, which means that Portage now understands that you want to keep this package updated as part of your system.

Using the --pretend (-p) option, you can see what emerge would do, without actually doing it:

root # emerge -p vim

Another equally handy option is the -a, or --ask option, which will display the packages to be merged, and then ask for confirmation from you as to whether you would like to proceed and merge the packages, or not:

root # emerge -a emacs

root ##g##These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] app-admin/eselect-emacs-1.13 
[ebuild  N     ] net-libs/liblockfile-1.09 
[ebuild  N     ] app-emacs/emacs-common-gentoo-1.3-r1  USE="-X -emacs22icons" 
[ebuild  N     ] app-editors/emacs-23.4-r1  USE="alsa gif gpm jpeg png tiff xpm -X -Xaw3d (-aqua) -athena -dbus -gconf -gtk -gzip-el -hesiod -kerberos -livecd -m17n-lib -motif -sound -source -svg -toolkit-scroll-bars -xft" 
[ebuild  N     ] virtual/emacs-23 

root ##b##Would you like to merge these packages? [Yes/No]##!b##  y

USE Variables

In the above emerge output, you can see some text beginning with USE= on the app-editors/emacs line. This means that this package has a number of optional build-time features which can be controlled using Portage USE variables.

It is possible to enable USE variables globally in /etc/portage/make.conf, on a per-package basis in /etc/portage/package.use, or as logical sets by using Funtoo Profiles. It's recommended that you first take a look at Funtoo Profiles and see if there may be sets of USE variables that you want to enable as a group. You can set your system flavor to more accurately reflect the intended use of your Funtoo system, and by doing so, many more USE variables will be set (or unset) to reasonable defaults for your intended use.

These USE variables can be set globally by adding a line such as this to /etc/portage/make.conf:

   /etc/portage/make.conf (bash source code)
USE="gif jpeg png tiff xpm"

Or, alternatively, you can enable just these USE variables for emacs by adding the following line to /etc/portage/package.use:

   /etc/portage/package.use (bash source code)
app-editors/emacs gif jpeg png tiff xpm

However, it's generally best to find a Funtoo Profile flavor or mix-in that serves your purpose. For example, setting your system to be a desktop by running epro flavor desktop or adding the appropriate mix-in via epro mix-in +mediaformat-gfx-common gives you more opportunity to dial in sets of related USE variables with a single command.

See the emerge page for more information on various emerge command-line options and best practices.

Default editor

Funtoo Linux also has a special meta-command called eselect, which can be used to set many default system settings. One of the things it is used for is to set the default editor used by things like crontab -e, etc that will automatically start an editor when run. Here is how to use eselect to change the default system editor:

root # eselect editor list
Available targets for the EDITOR variable:
  [1]   /bin/nano
  [2]   /bin/ed
  [3]   /usr/bin/ex
  [4]   /usr/bin/vi
  [ ]   (free form)
root # eselect editor set 4
Setting EDITOR to /usr/bin/vi ...
Run ". /etc/profile" to update the variable in your shell.

After logging in again, or typing source /etc/profile in the current shell, the new system editor will be active.

Note that if you want to use vim instead of a vi through busybox you also need to run:

root # eselect vi set vim

Updating your system

Sometimes, you may want to update the packages on your system. Often, this is done after you run ego sync, which will grab Portage tree updates from the main Funtoo Linux Portage tree:

root # ego sync
Syncing meta-repo
(cd /var/git/meta-repo && git remote set-branches --add origin master)
(cd /var/git/meta-repo && git fetch origin refs/heads/master:refs/remotes/origin/master)
remote: Counting objects: 95, done.
remote: Compressing objects: 100% (64/64), done.
remote: Total 95 (delta 31), reused 95 (delta 31), pack-reused 0
Unpacking objects: 100% (95/95), done.

You may also want to update your system after you have changed USE flag settings. To take advantage of the USE flags you have just enabled, it's necessary to recompile everything that includes them.

Below, you'll find a recommended emerge command for updating your entire system. The -a option will cause emerge to prompt you for confirmation before starting the merge:

root # emerge -auDN @world

-u tells emerge to update any already-installed but out-of-date packages that we specify on the command-line. The -D option tells emerge to perform a deep dependency tree graph, so it will include sub-dependencies of packages that we have specified on the command line as well. This allows emerge to perform as thorough an update of your system as possible.

The -N (--newuse) option tells Portage to check for any new USE flags that have been enabled or disabled, and rebuild packages so that all USE flags are set as currently defined in Funtoo Profiles, /etc/portage/make.conf and /etc/portage/package.use.

world is a "meta-package" or "package set" which includes every package that you have manually installed plus all packages in the system set. If you want to see a list of all these packages, look at /var/lib/portage/world:

root # cat /var/lib/portage/world
app-editors/vim
app-portage/eix
app-portage/gentoolkit
dev-vcs/git
net-misc/bridge-utils
net-misc/dhcpcd
net-misc/keychain
sys-apps/gptfdisk
sys-apps/pciutils
sys-devel/bc
sys-fs/reiserfsprogs
sys-kernel/vanilla-sources

Updating a few packages

If we simply wanted to rebuild a few packages to reflect updated USE flag settings, we could specify it instead of world. Be sure to include the -N option:

root # emerge -auDN vim emacs

Creating a user account

It's a good idea to create a normal user account that you can use for general Linux tasks. Before rebooting, create a user account for everyday use. Adjust the groups in the example below to match your needs. Some of them may not exist yet on your system. Replace "<user_name>" with the name you're going to use for your everyday user. The "-m" option instructs useradd to create a home directory for your user. See man useradd for more info.

root # useradd -m -G audio,video,cdrom,wheel,users <user_name>

Don't forget to set a password for your new user:

root # passwd <user_name>

Check Package:Sudo to enable sudo.