12.17. Linux flavours¶
12.17.1. Common administrative commands¶
Ubuntu |
CentOS 6.5 |
|
---|---|---|
System |
||
Heritage |
Debian |
Red Hat Enterprise Linux |
Package management |
|
|
General system update |
|
|
Package type |
|
|
Extra security |
Nothing complex by default |
SELinux; file permissions must be set with |
Autostarting daemons at boot |
Usually happens automatically |
Usually need to configure with |
Which OS version am I running? |
lsb_release -a uname -a |
cat /etc/centos-release uname -a |
Python |
||
Default Python versions (CamCOPS requires 3.4) |
2.7, 3.4 |
2.6 |
Apache |
||
Apache main configuration file |
Usually |
Usually |
Apache SSL configuration file |
Usually |
Usually |
Granting access in Apache config file |
Apache 2.4:
Require all granted |
Apache 2.2:
Order allow,deny Allow from all |
Default Apache system user |
|
|
Default SSL certificate location |
|
|
Default Apache log directory |
|
|
Restarting Apache |
|
|
supervisord |
||
supervisord configuration file |
Usually |
Usually |
Restarting supervisord |
|
|
MySQL |
||
Default MySQL configuration file |
|
|
Restarting MySQL |
|
|
Default MySQL log |
|
|
CamCOPS packages |
||
Installation |
|
|
Removal |
|
|
12.17.2. Installing CamCOPS prerequisites under RHEL 8.6¶
Probably also applicable to CentOS 8.x.
Ensure additional repositories are in use:
EPEL: see e.g. http://fedoraproject.org/wiki/EPEL
Erlang: see e.g. https://computingforgeeks.com/how-to-install-latest-erlang-on-rhel-8/
RabbitMQ: see e.g. https://computingforgeeks.com/how-to-install-rabbitmq-on-rhel-8/
If accessing the internet through a proxy, where the https_proxy
environment variable is defined, use: sudo -E
to pass the environment to the superuser.
If /tmp
has been securely mounted as noexec
you will need to remount it
as exec
. Remove the noexec
option from /etc/fstab
and sudo
mount -o remount /tmp
. This will allow alien
to execute scripts under
/tmp
. Otherwise you will get errors like /var/tmp/rpm-tmp.AbCDef: line 96:
/tmp/alien.nnnnnnn/script: Permission denied
when installing the package. You
can remount /tmp``as ``noexec
again after installation.
Potential prerequisites for what follows:
sudo dnf -y install python38 python38-devel python3-pip httpd mariadb-devel mod_ssl
sudo update-alternatives --config python3
12.17.3. Setting up MySQL under Linux¶
Under Ubuntu, if you are happy to leave the data files at their default location, skip this step. Check/edit the MySQL configuration (see table above for filenames). See Getting Started with MySQL. In particular:
datadir should point to your database files (default often /var/lib/mysql, but /srv/mysql is one alternative).
Other options are explained here.
If you create a blank directory (such as /srv/mysql), you will need to use the mysql_install_db tool; see Postinstallation Setup and Testing; an example command is
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/srv/mysql
Manual start: sudo /usr/bin/mysqld_safe –user=mysql &. Manual stop: sudo mysqladmin shutdown.
Service start/stop: see table above.
If it starts manually but not as a service (in a manner that depends on your data directory), you have a challenging problem; an option is to return to the default data directory!
To log in prior to securing the database: mysql.
See also the CentOS MySQL installation guide.
Default logfile: /var/log/mysqld.log or /var/log/mysql/…
Secure your MySQL installation by running mysql_secure_installation.
Login after securing: mysql -u root -p.
Similar username/password requirements now apply to manual shutdowns.
Ensure that the max_allowed_packet parameter is large enough.
This parameter needs to be set large enough that the largest binary large objects (BLOBs) can be uploaded. CamCOPS BLOBs are mostly photographs from tablets. A high-end tablet in 2014 might have an 8 megapixel (MP) camera, with each pixel taking 3 bytes, i.e. 24 Mb. Furthermore, the transfer takes more space thanks to somewhat inefficient encoding. The MySQL server default value is just 1 Mb 1.
You must set this parameter for the server, and for the mysqldump tool.
A suggested value is 32 Mb. Edit my.cnf to include max_allowed_packet values in the [mysqld] and [mysqldump] sections (creating them if necessary).
Similar editing of the [client] section of my.cnf is unnecessary, firstly because some other MySQL clients may not recognize the option and might choke on it, and secondly because CamCOPS uses MySQLdb (MySQL-Python), which uses the MySQL C API, which has a default limit of 1 Gb 2.
Set some other MySQL parameters for TEXT-heavy tables; see Troubleshooting: Row size too large.
Thus, edit my.cnf to include the following:
[mysqld] max_allowed_packet = 32M innodb_strict_mode = 1 innodb_file_per_table = 1 innodb_file_format = Barracuda # Only for MySQL prior to 5.7.5 (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-20.html): # innodb_log_file_size = 512M [mysqldump] max_allowed_packet = 32M
Ensure MySQL is running as a service (as above).
Create the CamCOPS database. See create a database.
Footnotes