Core OS Index

1.2. Configure

If you don't mounted chroot follow this steps from install;

        $ export CHROOT=/mnt
        
        $ export BLK_EFI=/dev/sda1
        $ export BLK_BOOT=/dev/sda2
        $ export BLK_ROOT=/dev/sda3
        $ export BLK_VAR=/dev/sda5
        $ export BLK_USR=/dev/sda7

        $ export BLK_HOME=/dev/sda8

        $ sudo mount $BLK_BOOT $CHROOT/boot
        $ sudo mount $BLK_EFI $CHROOT/boot/efi
        $ sudo mount $BLK_VAR $CHROOT/var
        $ sudo mount $BLK_USR $CHROOT/usr

        $ sudo mount $BLK_HOME $CHROOT/home
        

Now you can chroot;

        $ sudo chroot $CHROOT /usr/bin/env -i \
          HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
          PATH=/bin:/usr/bin:/sbin:/usr/sbin \
          /bin/bash --login
        

1.2.1. Set hostname and hosts

Give it a name, this example we will call it c9;

        # hostname c9
        

Edit /etc/hosts to contain your hostname and FQDN, this example also uses c9.example.org. If you wish get a subdomain from afraid.org pointing to your public ip, example of static 192.168.1.9 ip with c9.example.org pointing to c9 host;

        #
        # /etc/hosts: static lookup table for host names
        #

        # IPv4
        127.0.0.1	localhost c9
        #		
        # 192.168.1.9	c9.example.org
        

1.2.2. Set timezone

Setup timezone;

        # tzselect
        Please identify a location so that time zone rules can be set correctly.
        Please select a continent, ocean, "coord", or "TZ".
         1) Africa
         2) Americas
         3) Antarctica
         4) Asia
         5) Atlantic Ocean
         6) Australia
         7) Europe
         8) Indian Ocean
         9) Pacific Ocean
        10) coord - I want to use geographical coordinates.
        11) TZ - I want to specify the time zone using the Posix TZ format.
        #? 7

        Please select a country whose clocks agree with yours.
         1) ?land Islands         18) Greece                35) Norway
         2) Albania               19) Guernsey              36) Poland
         3) Andorra               20) Hungary               37) Portugal
         4) Austria               21) Ireland               38) Romania
         5) Belarus               22) Isle of Man           39) Russia
         6) Belgium               23) Italy                 40) San Marino
         7) Bosnia & Herzegovina  24) Jersey                41) Serbia
         8) Britain (UK)          25) Latvia                42) Slovakia
         9) Bulgaria              26) Liechtenstein         43) Slovenia
        10) Croatia               27) Lithuania             44) Spain
        11) Czech Republic        28) Luxembourg            45) Svalbard & Jan Mayen
        12) Denmark               29) Macedonia             46) Sweden
        13) Estonia               30) Malta                 47) Switzerland
        14) Finland               31) Moldova               48) Turkey
        15) France                32) Monaco                49) Ukraine
        16) Germany               33) Montenegro            50) Vatican City
        17) Gibraltar             34) Netherlands
        #? 37

        Please select one of the following time zone regions.
        1) mainland
        2) Madeira Islands
        3) Azores
        #? 1

        The following information has been given:

            Portugal
            mainland

        Therefore TZ='Europe/Lisbon' will be used.
        Local time is now:      Sun Aug  9 17:36:05 WEST 2016.
        Universal Time is now:  Sun Aug  9 16:36:05 UTC 2016.
        Is the above information OK?
        1) Yes
        2) No
        #? 1

        You can make this change permanent for yourself by appending the line
            TZ='Europe/Lisbon'; export TZ
        to the file '.profile' in your home directory; then log out and log in again.

        Here is that TZ value again, this time on standard output so that you
        can use the /usr/bin/tzselect command in shell scripts:
        Europe/Lisbon
        #
        

1.2.3. Set locale

        # localedef -i en_US -f UTF-8 en_US.UTF-8
        

1.2.4. Users

1.2.4.1. Set root password

        # passwd
        

1.2.4.2. Create Administrator User

        # useradd -U -m -k /etc/skel -s /bin/bash c9admin
        # passwd c9admin
        
        # chmod 0700 /root
        # chmod 0700 /home/c9admin
        

1.2.4.3 Add Administrator to Wheel group

        # usermod -a -G wheel c9admin
        
        bash-4.3# sudoedit /etc/sudoers
        
        ## Uncomment to allow members of group wheel to execute any command
        %wheel ALL=(ALL) ALL
        

1.2.5. File system table

First we will discover block id (UUID) of target partition, blkid list all while vol_id --uuid /dev/sdb1 returns only uuid. Add all block ids to the end of file /etc/fstab

        # blkid >> /etc/fstab
        

Read Securing mount points, and edit /etc/fstab according to your disk layout.

        #
        # /etc/fstab: static file system information
        #
        # <file system>        <dir>     <type>    <options>                        <dump> <pass>

        #/dev/#EXT4FS_ROOT#    /         ext4      defaults                         0      1
        #/dev/#BTRFS_ROOT#     /         btrfs     defaults                         0      0
        #/dev/#XFS_ROOT#       /         xfs       defaults                         0      0
        #/dev/#SWAP#           swap      swap      defaults                         0      0
        #/dev/#EXT4FS_HOME#    /home     ext4      defaults                         0      2
        #/dev/#BTRFS_HOME#     /home     btrfs     defaults                         0      0
        #/dev/#XFS_HOME#       /home     xfs       defaults                         0      0
        #/dev/cdrom            /cdrom    iso9660   ro,user,noauto,unhide            0      0
        #/dev/dvd              /dvd      udf       ro,user,noauto,unhide            0      0
        #/dev/floppy/0         /floppy   vfat      user,noauto,unhide               0      0
        #tmp                   /tmp      tmpfs     defaults                         0      0
        #shm                   /dev/shm  tmpfs     defaults                         0      0
        #usb                   /proc/bus/usb usbfs defaults                         0      0

        devpts                 /dev/pts  devpts    noexec,nosuid,gid=tty,mode=0620  0      0

        #/
        #/dev/sda3:
        UUID=c8776551-2a98-4335-9fcd-e337331216dd	/		ext4	defaults			0	0

        #/boot
        #/dev/sda2:
        UUID=3b408790-65e1-4638-9591-7ba61f266913	/boot		ext4	defaults,nodev,noexec,nosuid	0	0

        #/boot/efi
        #/dev/sda1:
        UUID=962D-0DE1					/boot/efi	vfat    umask=0077			0       0

        #/var
        #/dev/sda4:
        UUID=f0b112e2-6761-472f-b41e-e9c8ccd27702	/var            ext4    defaults,nodev,noexec,nosuid	0       0

        #/usr
        #/dev/sda6:
        UUID=35755a81-89b2-4f84-a945-5185d1d3b10b	/usr            ext4    defaults,nodev			0       0

        #/tmp
        #/dev/sda5:
        UUID=1325ee41-27c9-4621-ab69-125bb6e1c63b	/tmp            ext4    defaults,nodev,nosuid,noexec	0	0

        #/home
        #/dev/sda7
        UUID=0ccd903c-b9e2-425f-bd30-78682ffce361   	/home           ext4    defaults,nodev,nosuid		0       0


        #/usr/ports
        #/dev/sda8
        #UUID=d1df6743-d3cb-4d5a-badb-96cef3181095   	/usr/ports       ext4    defaults,nodev,nosuid,noexec	0       0

        #/usr/ports/work
        pkgmk   					/usr/ports/work tmpfs size=30G,gid=101,uid=101,defaults 0 	0


        #swap
        #/dev/sda9:
        UUID=2925bf9d-6111-43cb-ab3f-2d95c55e40ca  none            	swap    sw              		0       0

        # End of file
        

Pass option control in wich order fsck checks devices. If is a multiple partition scheme; 1 for root, 2 for others or 0 to disable.

1.2.6. Initialization Scripts

Edit /etc/rc.conf and define keyboard layout, hostname and timezone, more information about configuration variables.

        #
        # /etc/rc.conf: system configuration
        #

        FONT=default
        KEYMAP=dvorak
        TIMEZONE="Europe/Lisbon"
        HOSTNAME=c9
        SYSLOG=sysklogd
        SERVICES=(lo net crond)

        # End of file
        
Core OS Index

This is part of the c9 Manual. Copyright (C) 2016 Silvino Silva. See the file Gnu Free Documentation License for copying conditions.