Annotation of doc/build/debian10_install.frag, revision 1.5

1.1       raeburn     1: <h1>Installing LON-CAPA on a basic Debian 10 Server</h1>
                      2: <p>
                      3: This document guides you through the process of setting up a new LON-CAPA
1.2       raeburn     4: server/VM running Debian 10 with only the base set of packages installed. 
1.1       raeburn     5: The machine (virtual or real) will be configured solely as a LON-CAPA server and will be 
                      6: expected to have no other services running.  Your server/VM is expected to have
                      7: a reasonably fast connection to the internet.
                      8: </p><p>
                      9: More information is available at 
                     10: <a href="http://install.lon-capa.org/">http://install.lon-capa.org/</a>.
                     11: </p>
                     12: 
                     13: <h2>Before you begin</h2>
                     14: <p>
                     15: Installing Linux is getting easier and easier.
                     16: You will be required to log in to the machine and execute
                     17: some routine Linux commands.  Familiarity with the Apache web server, mod_perl, 
                     18: perl, and MySQL are not required to install and run LON-CAPA.
                     19: </p>
                     20: 
                     21: <h2>Installation Overview</h2>
                     22: <p>
                     23: The installation process takes the following steps:
                     24: </p>
                     25: <ol>
                     26:   <li><a href="#obt">Obtain Debian 10 .iso</a></li>
                     27:   <li><a href="#net">Determine Network Settings</a></li>
                     28:   <li><a href="#lin">Install Debian 10</a></li>
                     29:   <li><a href="#upd">Update your system</a></li>
                     30:   <li><a href="#ilc">Install LON-CAPA</a></li>
                     31:   <li><a href="#cdc">Create a Domain Coordinator</a></li>
                     32:   <li><a href="#sts">Start/Restart services</a></li>
                     33:   <li><a href="#log">Log in to LON-CAPA</a></li>
                     34: </ol>
                     35: 
                     36: <hr>
                     37: <h2>1. <a name="obt">Obtain Debian 10 .iso file</a></h2>
                     38: <p>
                     39: Debian 10 .iso files can be obtained from the <a href="https://www.debian.org/distrib/">Getting Debian</a> page. Either a small installation image .iso for installation over the network or a larger complete installation image .iso can be downloaded.
                     40: </p>
                     41: <h2>2. <a name="net">Determine Network Settings</a></h2>
                     42: <p>
                     43: You will need to know the following network settings for your installation.
                     44: <b>Note:</b>You must have a static IP address to use LON-CAPA.
                     45: DHCP is <em>not</em> supported.
                     46: 
                     47: <ul>
                     48:   <li>ip address </li>
                     49:   <li>netmask </li>
                     50:   <li>hostname </li>
                     51:   <li>gateway </li>
                     52:   <li>domain name server(s) </li>
                     53: </ul>
                     54: 
                     55: <h2>3. <a name="lin">Debian 10 installation</a></h2>
                     56: <p>
                     57: Installing Debian Linux is straightforward.
                     58: Documentation is available from
                     59: <a href="https://www.debian.org/releases/stable/installmanual">https://www.debian.org/releases/stable/installmanual/</a>
                     60: Most of the installation screens are self explanatory. (Choose "Graphical Install").
                     61: There are a few steps that require comment and are dealt with below.
                     62: </p>
                     63: <dl style="list-style:square outside none">
                     64:    <dt>Installation Language</dt>
                     65:    <dd>Use English as your installation language.</dd>
                     66:    <dt>Partitioning your Drive</dt>
                     67:    <dd>For a fresh install you may want to use the automatic partitioning feature of the installer.
                     68:        If you decide to customize partitioning, the following may be useful to know.
                     69:        LON-CAPA resource files are stored in the /home directory, so the
                     70:        majority of the disk space should be allocated here.  If you have 20 GB 
1.2       raeburn    71:        of space for Debian, /home should receive at least 10 to 12 GB. 
1.1       raeburn    72:        Since MySQL uses the /var filesystem to store its databases you should
                     73:        have at least 4 gigs of space available on /var.  Be sure to 
                     74:        include adequate swap space.  A minimum is 512 Megs, but you should
                     75:        typically have 1 or 2x as much swap space as you do physical RAM.</dd>
                     76: 
                     77:    <dt>Network Configuration</dt>
                     78:    <dd>LON-CAPA will <b>not</b> work with a machine set up to use a dynamic 
                     79:        IP address.  When configuring your network card, be sure to unselect
                     80:        the DHCP option and enter in your network information.</dd>
                     81:    <dt>Software Selection</dt>
                     82:    <dd>The base system will be installed. Once that is complete you will have the option to select additional software collections. By default, "standard system utilities" will be checked -- leave that checked, and (optionally) also check SSH Server, if you plan to ssh into your Debian 10 Server/VM from another machine.</dd>
                     83: </dl>
                     84: <p>
1.2       raeburn    85: Finish installing your server, reboot it, and log in with the username you created during installation.
1.1       raeburn    86: </p>
1.4       raeburn    87: <h3>Enabling sudo</h3>
1.5     ! raeburn    88: <p>If you wish to allow the username created during installation to have administration privileges using sudo, use su to become root and execute the following, replacing <i>&lt;username&gt;</i> with that specific username:
1.1       raeburn    89: </p>
                     90: <pre>
                     91: apt-get install sudo
                     92: /sbin/adduser <username> sudo
                     93: exit
                     94: </pre>
1.3       raeburn    95: <p>Now logout and log in again with that username. If you prefer not to use sudo, then you should omit all instances of <i>sudo</i> when executing all commands listed on the remainder of this page, after using su to become root.
1.1       raeburn    96: </p>
                     97: <h3>Firewall Configuration</h3>
                     98: <p>
                     99: Use ufw to allow incoming traffic for the following services:
                    100: ssh, www, https
                    101: </p>
                    102: <p>Check if ufw is installed</p>
                    103: <pre>sudo dpkg-query -s ufw |grep Status</pre>
                    104: <p>If the result is not: <i>Status: install ok installed</i>, then install it:
                    105: <pre>sudo apt-get install ufw</pre>
                    106: <p>Configure ufw by executing the following:</p>
                    107: <pre>
                    108: sudo ufw default deny
                    109: sudo ufw enable
                    110: sudo ufw allow ssh
                    111: sudo ufw allow www
                    112: sudo ufw allow https
                    113: sudo ufw reload
                    114: </pre>
                    115: <h3>E-mail: Postfix Installation</h3>
                    116: <p>
                    117: Configure to "Internet Site" to allow LON-CAPA to send e-mail to users.
                    118: </p>
                    119: <pre>
                    120: sudo apt-get install postfix
                    121: </pre>
                    122: <h3>E-mail: Postfix Configuration</h3>
                    123: <p>
                    124: If you need to change the postfix configuration in the future use:
                    125: </p>
                    126: <pre>
                    127: sudo dpkg-reconfigure postfix
                    128: </pre>
                    129: <h3>Time synchronization service</h3>
                    130: <p>
                    131: You will use chrony for time synchronization, so if timesyncd is installed you should remove it.
                    132: </p>
                    133: <pre>
                    134: sudo systemctl stop systemd-timesyncd
                    135: sudo systemctl disable systemd-timesyncd
                    136: sudo apt-get remove systemd-timesyncd
                    137: sudo apt-get install chrony
                    138: sudo systemctl start chrony
                    139: sudo systemctl enable chrony
                    140: </pre>
                    141: <h2>4. <a name="upd">Update your system</a></h2>
                    142: <p>
                    143: Update your system to the latest versions of the system software using apt-get
                    144: </p>
                    145: <pre>
                    146: sudo apt-get update
                    147: sudo apt-get upgrade
                    148: </pre>
                    149: <p>
                    150: If kernel packages were updated, reboot your system before continuing with the installation.
                    151: </p>
                    152: <h2>5. <a name="ilc">Installing LON-CAPA</a></h2>
                    153: <h3>Import the LON-CAPA encryption key</h3>
                    154: <p>Check if gpg is installed</p>
                    155: <pre>sudo dpkg-query -s gpg |grep Status</pre>
                    156: <p>If the result is not: <i>Status: install ok installed</i>, then install it:</p>
                    157: <pre>sudo apt-get install gpg</pre>
                    158: <p>Check if wget is installed</p>
                    159: <pre>sudo dpkg-query -s wget |grep Status</pre>
                    160: <p>If the result is not: <i>Status: install ok installed</i>, then install it:</p>
                    161: <pre>sudo apt-get install wget</pre>
                    162: <p>Check if /etc/apt/keyrings directory exists by executing:</p>
                    163: <pre>
                    164: ls -al /etc/apt/keyrings
                    165: </pre>
                    166: <p>If it is missing, create it by executing:</p>
                    167: <pre>
                    168: sudo mkdir /etc/apt/keyrings
                    169: </pre>
                    170: <p> Execute: </p>
                    171: <pre>
                    172: wget -q -O - https://install.loncapa.org/versions/debian/APT-GPG-KEY-loncapa.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/loncapa.gpg > /dev/null
                    173: </pre>
                    174: <h3>Add LON-CAPA debian repository to /etc/apt/sources.list.d</h3>
                    175: <p> Execute: </p>
                    176: <pre>
                    177: echo "deb [signed-by=/etc/apt/keyrings/loncapa.gpg] https://install.loncapa.org/debian buster main" | sudo tee /etc/apt/sources.list.d/loncapa.list
                    178: </pre>
                    179: <p>
                    180: You can display which standard Debian repositories are currently enabled by executing:
                    181: </p>
                    182: <pre>
                    183: grep '^deb ' /etc/apt/sources.list |grep ' buster'
                    184: </pre>
                    185: <p>The output should be similar to the following (with deb.debian.org replaced with your preferred mirror site):</p>
                    186: <pre>
                    187: deb http://deb.debian.org buster main
                    188: deb http://security.debian.org/debian-security buster/updates main
                    189: </pre>
                    190: <h3>Install prerequisites</h3>
                    191: <p> Execute: </p>
                    192: <pre>
                    193: sudo apt-get update
                    194: sudo apt-get install loncapa-prerequisites
                    195: </pre><p>
                    196: This may take some minutes due to LON-CAPA's large number of dependencies.
                    197: </p>
                    198: <h3>Set MPM mode for Apache web server and enable use of cgi scripts and webDAV</h3>
                    199: <p>Execute: </p>
                    200: <pre>
                    201: sudo a2dismod mpm_event
                    202: sudo a2enmod mpm_prefork
                    203: sudo a2enmod cgi
                    204: sudo a2enmod dav
                    205: sudo a2enmod dav_fs
                    206: </pre>
                    207: <h3>Retrieve and execute LON-CAPA setup program</h3>
                    208: <p>
                    209: Retrieve the LON-CAPA setup script and dependencies with the following command:
                    210: </p>
                    211: <pre>
                    212: wget http://install.loncapa.org/linux/install.tar
                    213: </pre>
                    214: <p>
                    215: Extract the archive with the following command:
                    216: </p>
                    217: <pre>
                    218: tar xf install.tar
                    219: </pre>
                    220: <p>
                    221: This creates a directory named <tt>installation</tt>.  Change to it and
                    222: execute the setup script with the following commands:
                    223: </p>
                    224: <pre>
                    225: cd installation
                    226: sudo ./install.pl
                    227: </pre>
                    228: <p>
                    229: The script is used to prepare a Linux system to run LON-CAPA, and can also be
                    230: used to check the configuration of a system on which LON-CAPA has already been installed.  Typically, though, you will run this script only once, when you first install LON-CAPA.
                    231: </p>
                    232: <p>
                    233: The script will analyze your system to determine which actions are recommended.  The script will then prompt you to choose the actions you would like taken.
                    234: Once a choice has been entered for all nine possible actions, required changes will be made.
                    235: </p>
                    236: <p>The possible actions are:
                    237: <ul>
                    238: <li>Create the www user/group</li>
                    239: <li>Install the package LON-CAPA uses to authenticate users.</li>
                    240: <li>Set-up the MySQL database</li>
                    241: <li>Set-up MySQL permissions</li>
                    242: <li>Configure Apache web server</li>
                    243: <li>Configure start-up of services</li>
                    244: <li>Check firewall settings</li>
                    245: <li>Stop services not used by LON-CAPA,<br>
                    246:     e.g., services for a print server: cups daemon</li>
                    247: <li>Download LON-CAPA source code in readiness for installation</li>
                    248: </ul>
                    249: </p>
                    250: 
                    251: <h3>Determine LON-CAPA Settings</h3>
                    252: <p>
                    253: LON-CAPA requires a number of identifying parameters to be set in order
                    254: for it to function at all.  Below is a list with descriptions.
                    255: </p>
                    256: <dl>
                    257:   <dt>Host Type (library or access)</dt>
                    258:   <dd>The server must be designated a 'library' or an 'access' server.  In
                    259:       general you should have a library server for your instructors to create
                    260:       their course content on and run their courses.  Students should connect
                    261:       to access servers.  If you are doing the first install of LON-CAPA at 
                    262:       your site, or if you are playing with it for your own edification you
                    263:       should make your machine a 'library' server.</dd>
                    264:   <dt>LON-CAPA domain</dt>
                    265:   <dd>Each site or school which installs LON-CAPA needs its own domain.
                    266:       Here at MSU we use 'msu'.  You should choose something short but
                    267:       meaningful.  <i>Restriction: One word, no hyphens, underscores, or 
                    268:       special characters.</i><br>Domain names which include a departmental 
                    269:       abbreviation are not recommended as although LON-CAPA may start in
                    270:       a single department, other departments frequently join subsequently.
                    271:       For a domain name: 'msu' is a superior choice to 'msuphys' for example.
                    272:   </dd>
                    273:   <dt>LON-CAPA host id</dt>
                    274:   <dd>Each LON-CAPA server requires a unique internal name.  We use names
                    275:       such as "msul1" for the first library server. <i>Restriction: One word, 
                    276:       no hyphens, underscores, or special characters.</i>
                    277:   </dd>
                    278:   <dt>Domain's Primary Library Server ID</dt>
                    279:    <dd>If you are setting up a domain with a single library server, then the domain's primary library server ID will be the LON-CAPA host id of that server (e.g., msul1). Once your domain grows and you need to add more servers, one of the library servers in the domain should be assigned as the domain's primary library server.  This will be where domain-wide settings will be stored.<dd>
                    280:   <dt>Host administrator email</dt>
                    281:   <dd>The amount of email sent to this address is relatively minimal.  Messages
                    282:       are sent every time the system starts up, or if the system is in 
                    283:       serious trouble. On a laptop, make this <tt>root@localhost</tt>.
                    284:   </dd>
                    285:   <dt>Support email address</dt>
1.2       raeburn   286:   <dd>If you enter an e-mail address here, then users of the system 
1.1       raeburn   287:       will be able to click an "Ask Helpdesk" link in the system to 
                    288:       display a web form which they will complete to request support from
                    289:       your institution's helpdesk. On form submission the contents 
1.2       raeburn   290:       will be sent to the e-mail address you specify.
1.1       raeburn   291:   </dd>
                    292: </dl>
                    293: 
                    294: <h3>Configuring LON-CAPA</h3>
                    295: <p>
                    296: To configure and install LON-CAPA, execute the following commands:
                    297: </p>
                    298: <pre>
                    299: cd ../loncapa-X.Y.Z  (X.Y.Z should correspond to a version number like '2.11.5')
                    300: sudo ./UPDATE
                    301: </pre>
                    302: <p>
                    303: You will need to enter the LON-CAPA configuration information you determined 
                    304: in the previous section.
                    305: </p>
                    306: 
                    307: <h2>6. <a name="cdc">Creating a Domain Coordinator</a></h2>
                    308: <p>
                    309: You will need at least one user at your site who has the role of
                    310: 'domain coordinator'.  This user creates accounts for other users and
                    311: grants them additional privileges.  The make_domain_coordinator.pl script
                    312: invoked below requires that you enter the user's password.
                    313: Replace USERNAME and DOMAIN with an appropriate username and your domain.
                    314: </p>
                    315: <pre>
                    316: cd loncom/build
                    317: sudo perl make_domain_coordinator.pl USERNAME DOMAIN
                    318: cd
                    319: </pre>
                    320: 
                    321: <h2>7. <a name="sts">Start/Restart Services</a></h2>
                    322: <p>
                    323: The LON-CAPA network services take a moment to start.  Most misconfigurations
                    324: will be apparent at this step.
                    325: </p>
                    326: <pre>
                    327: sudo /home/httpd/perl/loncontrol start
                    328: sudo systemctl restart apache2
                    329: exit
                    330: </pre>
                    331: <p>
                    332: If you receive warnings about missing perl modules when starting Apache,
                    333: please make sure you followed the instructions in 
                    334: <b>Installing prerequisites</b>.  If you still have errors, please
                    335: contact the MSU LON-CAPA group.
                    336: </p>
                    337: 
                    338: <h2>8. <a name="log">Log in to your LON-CAPA Machine</a></h2>
                    339: <p>
                    340: Point a web browser at your new machine and log in as the domain
                    341: coordinator.  Congratulations!
                    342: </p>
                    343: 
                    344: <hr>
                    345: <h2>If things aren't working right</h2>
                    346: <p>
                    347: If you've followed the steps above and the server doesn't start or you think 
                    348: there's something wrong, please send a <a href="http://help.loncapa.org/help">help request</a> to the MSU LON-CAPA group.  If there were errors in installation of the dependency .deb packages or errors during the
                    349: automatic setup, please send us as much information as possible.
                    350: If some part of this document is unclear please let us know.
                    351: </p>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>