This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:arch_home_directories [2012/10/04 17:53] walter |
linux:arch_home_directories [2021/05/02 21:36] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Home Directories on Arch Linux ====== | ||
+ | |||
====== Client Config ====== | ====== Client Config ====== | ||
Line 5: | Line 7: | ||
Install Required Packages | Install Required Packages | ||
<code> | <code> | ||
- | pacman -S rpcbind nfs-utils nfsidmap ntp | + | pacman -S rpcbind nfs-utils nfsidmap |
</code> | </code> | ||
Line 12: | Line 14: | ||
Change the lines in these files to the values defined. | Change the lines in these files to the values defined. | ||
- | **The Domain should be acm.cs, but this is not working properly but localdomain does** | + | |
<file|/etc/idmapd.conf> | <file|/etc/idmapd.conf> | ||
- | Domain = localdomain | + | Domain = acm.cs |
</file> | </file> | ||
<file|/etc/conf.d/nfs-common> | <file|/etc/conf.d/nfs-common> | ||
Line 20: | Line 22: | ||
</file> | </file> | ||
<file|/etc/fstab> | <file|/etc/fstab> | ||
- | 172.29.0.6:/nfs-dir /mount-point nfs4 rw,hard,intr 0 0 | + | 172.29.0.6:/nfs-dir /mount-point nfs4 rw,hard,defaults 0 0 |
</file> | </file> | ||
- | <file|/etc/ntp.conf> | + | <file|/etc/systemd/timesyncd.conf> |
- | # The NFS Server | + | [Time] |
- | server 172.29.0.6 iburst | + | NTP=172.29.0.6 172.29.0.7 |
- | + | FallbackNTP=0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org | |
- | # Only allow read-only access from localhost | + | |
- | restrict default ignore | + | |
- | restrict 127.0.0.1 | + | |
- | restrict 172.29.0.6 mask 255.255.255.255 | + | |
</file> | </file> | ||
Line 38: | Line 36: | ||
* rpcbind | * rpcbind | ||
* nfs-common | * nfs-common | ||
- | * nptd | + | * systemd-timesyncd (timedatectl set-ntp true) |
Start rpcbind then nfs-common, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries. | Start rpcbind then nfs-common, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries. | ||
Line 51: | Line 49: | ||
Install Required Packages | Install Required Packages | ||
<code> | <code> | ||
- | pacman -S rpcbind nfs-utils nfsidmap | + | pacman -S rpcbind nfs-utils nfsidmap openntpd |
</code> | </code> | ||
Line 58: | Line 56: | ||
Change the lines in these files to the values defined. | Change the lines in these files to the values defined. | ||
- | <file|/etc/idmapd.conf> | + | |
- | Domain = acm.cs | + | |
- | </file> | + | |
- | <file|/etc/conf.d/nfs-common> | + | |
- | NEED_IDMAPD="yes" | + | |
- | </file> | + | |
The number of nfsd threads in increased from the default to improve preformance. | The number of nfsd threads in increased from the default to improve preformance. | ||
<file|/etc/conf.d/nfs-server> | <file|/etc/conf.d/nfs-server> | ||
Line 70: | Line 63: | ||
</file> | </file> | ||
Configure the NTP server to sync against the US NTP pool and make sure that clients on the LAN have access | Configure the NTP server to sync against the US NTP pool and make sure that clients on the LAN have access | ||
- | <file|/etc/ntp.conf> | + | <file|/etc/ntpd.conf> |
- | server 0.us.pool.ntp.org iburst | + | # sample ntpd configuration file, see ntpd.conf(5) |
- | server 1.us.pool.ntp.org iburst | + | |
- | server 2.us.pool.ntp.org iburst | + | |
- | server 3.us.pool.ntp.org iburst | + | |
- | #This next part will make it sync the time from the internal clock if it can't get out to the internet | + | |
- | #The time may be wrong, but clients on the LAN will still be sync'd with the server preventing shews with NFS served files | + | |
- | server 127.127.1.0 | + | |
- | fudge 127.127.1.0 stratum 10 | + | |
- | + | ||
- | # you should not need to modify the following paths | + | |
- | driftfile /var/lib/ntp/ntp.drift | + | |
- | logfile /var/log/ntp.log | + | |
- | + | ||
- | # If you want to deny all machines (including your own) | + | |
- | # from accessing the NTP server, uncomment: | + | |
- | restrict default nomodify nopeer notrap noquery | + | |
- | # To deny other machines from changing the | + | # Addresses to listen on (ntpd does not listen by default) |
- | # configuration but allow localhost: | + | listen on 0.0.0.0 |
- | #restrict default nomodify nopeer | + | |
- | restrict 127.0.0.1 | + | |
- | restrict 0.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery | + | # sync to a single server |
- | restrict 1.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery | + | #server ntp.example.org |
- | restrict 2.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery | + | |
- | restrict 3.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery | + | |
- | # To allow machines within your network to synchronize | + | # use a random selection of NTP Pool Time Servers |
- | # their clocks with your server, but ensure they are | + | # see http://support.ntp.org/bin/view/Servers/NTPPoolServers |
- | # not allowed to configure the server or used as peers | + | servers us.pool.ntp.org |
- | # to synchronize against, uncomment this line. | + | |
- | # | + | |
- | restrict 172.29.0.0 mask 255.255.255.0 nomodify notrap | + | |
</file> | </file> | ||
Line 118: | Line 88: | ||
Three daemons need to be started after networking in order to serve NFS directories and one to keep things working right | Three daemons need to be started after networking in order to serve NFS directories and one to keep things working right | ||
- | * rpcbind | + | * rpcbind.service |
- | * nfs-common | + | * nfs-client.target |
- | * nfs-server | + | * nfs-server.service |
- | * nptd | + | * opennptd.service |
Start rpcbind, then nfs-common, and then nfs-server, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries. | Start rpcbind, then nfs-common, and then nfs-server, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries. | ||
- | Your daemons array line should be similar to this. | + | Enable the appropriate daemons via the systemd systemctl command |
- | <file|/etc/rc.conf> | + | |
- | DAEMONS=(*foobar* net-profiles *foo* @ntpd rpcbind nfs-common nfs-server *bar*) | + | |
- | </file> | + | |
===== Moving /var/lib/nfs to tempfs ===== | ===== Moving /var/lib/nfs to tempfs ===== | ||
Line 139: | Line 106: | ||
</file> | </file> | ||
- | Copy /var/lib/nfs to a separate directory called /var/lib/nfs.d then add this file to /etc/rc.d and add it to the daemons line in rc.d | + | Copy /var/lib/nfs to a separate directory called /var/lib/nfs.d then add these files to setup the systemd service. |
- | <file|/etc/rc.d/nfsvartemp> | + | |
- | #!/bin/bash | + | |
- | . /etc/rc.conf | + | |
- | . /etc/rc.d/functions | + | |
- | case "$1" in | + | <file|/etc/systemd/system/nfsvartemp.service> |
- | start) | + | |
- | stat_busy 'Resetting NFS dir /var/lib/nfs' | + | [Unit] |
- | cp -R /var/lib/nfs.d/* /var/lib/nfs | + | Description=NFS Tempfs Setup |
- | stat_done | + | Before=nfsd.service |
- | ;; | + | |
- | + | [Service] | |
- | stop) | + | Type=oneshot |
- | stat_busy 'This does nothing' | + | ExecStart=/usr/local/sbin/nfsvartemp |
- | stat_done | + | |
- | ;; | + | [Install] |
- | restart) | + | WantedBy=multi-user.target |
- | $0 stop | + | |
- | ;; | + | |
- | + | ||
- | *) | + | |
- | echo "Usage: $0 {start|stop|restart}" | + | |
- | esac | + | |
</file> | </file> | ||
- | [[https://wiki.archlinux.org/index.php/Using_tmpfs_for_/var/*]] | + | <file|/usr/local/sbin/nfsvartemp> |
+ | #!/bin/bash | ||
+ | cp -R /var/lib/nfs.d/* /var/lib/nfs | ||
+ | </file> | ||
+ | |||
+ | Lastly | ||
+ | <code> | ||
+ | systemctl enable nfsvartemp.service | ||
+ | </code> |