« Previous 1 2 3 4 Next »
Managing FOSS applications on AIX
Tools at the Ready!
Configuring HTTPd
After the local repository is created, it can be shared with and accessed by DNF clients over HTTP (or HTTPS). To do so, you first need to install and start a web server on the local repo server (e.g., Apache or Nginx). This example installs httpd (Apache) and a couple of tools:
# dnf -y install httpd # dnf -y tcping # dnf -y lynx
You would then configure the httpd.conf file to allow access to the location of the local repository on the repo server. I like to install the tcping and lynx tools, as well, because they are useful in monitoring and troubleshooting web servers.
The HTTP directives code (Listing 7) provides a sample of the Apache directives that can be added to the httpd.conf file to allow access to the repository directory. You need to restart the HTTP server for the changes to take effect. In this example, /aixtoolbox is the directory that contains the repository.
Listing 7
Apache Directives
ServerName sisko.edu.ibm
...
<Directory "/aixtoolbox">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /aixtoolbox "/aixtoolbox"
The ServerName directive was added so Apache could determine the server's fully qualified domain name during startup. The <Directory> directive encloses a group of directives that apply only to the named directory, sub-directories of that directory, and the files within these directories. In this case, the directory is /aixtoolbox.
The AllowOverride None directive ignores any .htaccess files (providing access without requiring a password). The Require all granted directive allows access from any IP address, and the Alias directive allows documents to be stored in a local filesystem other than under the default Apache DocumentRoot. So, for example, a request for example.com/aixtoolbox would cause the web server to return files in /aixtoolbox.
Also add the stanza
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
</Location>to the bottom section of the file to allow the status of the Apache server to be queried from the command line with the apachectl command. Next, start the Apache server and confirm the httpd daemon is responding:
# apachectl start # tcping sisko 80 sisko port 80 open.
As shown, it should report that port 80 is open.
Checking the status of the HTTPd server shows it is healthy and ready to respond to HTTP requests (Listing 8).
Listing 8
Apache Server Status
# apachectl status Apache Server Status for localhost (via 127.0.0.1) Server Version: Apache/2.4.58 (Unix) ...etc...
Now perform another test by connecting to the web server from the command line (with lynx), and confirm you can access the /aixtoolbox location over HTTP on your local repo server (Listing 9).
Listing 9
Confirming Access over HTTP
# lynx http://sisko//aixtoolbox -dump
Index of /aixtoolbox
* [1]Parent Directory
* [2].Version
* [3]CONTENTS.toolbox
* [4]LICENSES/
* [5]README.toolbox
* [6]RPMS.bygroup/
* [7]RPMS/
* [8]SRPMS/
* [9]contrib/
* [10]docs/
* [11]ezinstall/
* [12]installp/
* [13]usr/
...etc...
The output from lynx confirms the HTTPd server is functioning. DNF clients can now access the local repo server over HTTP.
Client Access to Local Repo Server
To configure the DNF clients to access the local repo server over HTTP, edit the dnf.conf file and add entries for each repository, along with the HTTP URL for the local repo server. Listing 10 shows a client dnf.conf file configured to access a local repo server named sisko over http://
. Note that the repo IDs and names have all been set to start with My_, to identify a custom local configuration.
Listing 10
Configuring DNF Clients
[My_AIX_Toolbox] name=My AIX generic repository baseurl=http://sisko:80//aixtoolbox/RPMS/ppc enabled=1 gpgcheck=0 [My_AIX_Toolbox_noarch] name=My AIX noarch repository baseurl=http://sisko:80//aixtoolbox/RPMS/noarch/ enabled=1 gpgcheck=0 [My_AIX_Toolbox_73] name=My AIX 7.3 specific repository baseurl=http://sisko:80//aixtoolbox/RPMS/ppc-7.3/ enabled=1 gpgcheck=0
Once the dnf.conf file is configured, run the dnf repolist command to verify that all the repositories (on sisko) are available to the client. Listing 11 confirms that the repo IDs all start with My_.
Listing 11
Checking Repo IDs
# dnf repolist repo id repo name My_AIX_Toolbox AIX generic repository My_AIX_Toolbox_73 AIX 7.3 specific repository My_AIX_Toolbox_noarch AIX noarch repository
Running the same command again, this time with the verbose option, shows that the local repo server is in use by the DNF client, as per the Repo-baseurl entry (Listing 12).
Listing 12
Local Repo Server In Use
# dnf repolist -v | grep Repo-baseurl Repo-baseurl : http://sisko:80//aixtoolbox/RPMS/ppc Repo-baseurl : http://sisko:80//aixtoolbox/RPMS/ppc-7.3/ Repo-baseurl : http://sisko:80//aixtoolbox/RPMS/noarch/
From one of your DNF clients you can now test that the local repo server works (over HTTP). In this example, you install the zoo
package from your local repo server and turn on verbose output to see additional information, noting in which repository the zoo
package is installed (i.e., from My_AIX_Toolbox; Listing 13).
Listing 13
Installing zoo
# dnf -yv install zoo ...etc... --> Starting dependency resolution ---> Package zoo.ppc 2.10-5 will be installed ...etc.. Installing: zoo ppc 2.10-5 My_AIX_Toolbox 62 k ...etc... Installed: zoo-2.10-5.ppc Complete!
Back on the repo server, you can search the web server logfile, access_log, for the HTTP GET request for the zoo RPM file from the client:
# grep zoo /var/log/httpd/access_log 10.8.12.141 - - [11/Oct/2024:00:14:14 -0500] "GET //aixtoolbox/RPMS/ppc/zoo-2.10-5.aix5.1.ppc.rpm HTTP/1.1" 200 63688
On the DNF client, you can open the dnf.log file with view /var/log/dnf.log and search the log for the installation of the zoo
package with DNF (Listing 14).
Listing 14
Find Package in Logfile
...
2024-10-11T04:51:46Z DEBUG DNF version: 4.2.17
2024-10-11T04:51:46Z DDEBUG Command: dnf -yv install zoo
...
2024-11-01T01:15:33Z DEBUG ---> Package zoo.ppc 2.10-5 will be installed
...etc...
Installing:
zoo.......ppc.......2.10-5...........My_AIX_Toolbox...............62 k
...etc...
Installed:
zoo-2.10-5.ppc
...
With these steps complete, you've now configured your AIX DNF client to use a local repo server. Next, I'll review how you can use DNF to manage OSS packages on AIX.
Open Source Packages on AIX
Now that you have DNF installed and a local repo server up and running, you'll want to look at how to install, make operational, and manage OSS packages on AIX. As an example we'll install the open source MariaDB Server from the AIX Toolbox. This popular open source relational database was developed by the original developers of MySQL [10].
From the AIX Toolbox, use DNF to install the MariaDB Server:
dnf -y install mariadb-server
To avoid any out-of-memory messages when starting the database, change the AIX user limits for the root
and mysql
users, with the chuser command (Listing 15).
Listing 15
Changing Limits
# chuser core=-1 cpu=-1 data=-1 fsize=-1 stack=-1 nofiles=-1 core_hard=-1 cpu_hard=-1 data_hard=-1 fsize_hard=-1 stack_hard=-1 nofiles_hard=-1 root # chuser core=-1 cpu=-1 data=-1 fsize=-1 stack=-1 nofiles=-1 core_hard=-1 cpu_hard=-1 data_hard=-1 fsize_hard=-1 stack_hard=-1 nofiles_hard=-1 mysql
You can verify that the user limits have been changed successfully with the
lsuser -f <username>
command and check that the updated attributes are set to -1.
Now you can start a new root user session with su -, which starts a new root shell with the updated user attributes from the previous step. You can check that the new limits for the root user have taken effect by running the ulimit command before and after the su - command. Note that the majority of resource limits are now set to unlimited (Listing 16).
Listing 16
Checking New Limits
# ulimit -a time(seconds) unlimited file(blocks) 2097151 data(kbytes) 131072 stack(kbytes) 32768 memory(kbytes) 32768 coredump(blocks) 2097151 nofiles(descriptors) 2000 threads(per process) unlimited processes(per user) 128 # su - # ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) unlimited memory(kbytes) 32768 coredump(blocks) unlimited nofiles(descriptors) unlimited threads(per process) unlimited processes(per user) 128
The next step is to prepare the database server setup to handle the initialization tasks that must be performed before the database server (mysqld) is ready to use. It initializes the database data directory and creates the system tables it contains, initializes the system tablespace and related data structures needed to manage InnoDB tables, loads the server-side help tables, installs the sys schema, and creates an administrative account (Listing 17).
Listing 17
Initializing Database Server
# mysql_install_db --user=mysql Installing MariaDB/MySQL system tables in '/opt/freeware/var/lib/mysql/data' ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mysql@localhost, it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at http://mariadb.com/kb You can start the MariaDB daemon with: cd '/opt/freeware' ; /opt/freeware/bin/mysqld_safe --datadir='/opt/freeware/var/lib/mysql/data' You can test the MariaDB daemon with mysql-test-run.pl cd '/opt/freeware/mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ #
Now you can start the database server with the command:
# echo "/opt/freeware/bin/mysqld_safe --datadir='/opt/freeware/var/lib/mysql/data'" | at now
Next, check that the MariaDB server process is running (Listing 18).
Listing 18
Checking mysqld
# ps -ef | grep mysqld
mysql 8323484 18219314 0 21:39:57 pts/1 0:00 /opt/freeware/libexec/mysqld --basedir=/opt/freeware --datadir=/opt/freeware/var/lib/mysql/data --plugin-dir=/opt/freeware/lib64/mariadb/plugin --user=mysql --log-error=/opt/freeware/var/log/mysql/mysqld.log --pid-file=/opt/freeware/var/lib/mysql/mysqld.pid --socket=/opt/freeware/var/lib/mysql/mysql.sock
root 18219314 14418290 0 21:39:57 pts/1 0:00 /bin/sh /opt/freeware/bin/mysqld_safe
You can check the status of the server and get a prompt with:
/opt/freeware/bin/mysql -u root mysql ... MariaDB [mysql]>
At the resulting prompt, type status to see the active status of the database server (Listing 19); then, type exit; to return to the shell, change to the mysql
user, and connect to the database server (Listing 20).
Listing 19
MariaDB Server Status
MariaDB [mysql]> status -------------- /opt/freeware/bin/mysql Ver 15.1 Distrib 10.4.26-MariaDB, for AIX7.1 (powerpc) using readline 5.1 Connection id: 9 Current database: mysql Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.4.26-MariaDB Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /opt/freeware/var/lib/mysql/mysql.sock Uptime: 17 sec Threads: 6 Questions: 75 Slow queries: 0 Opens: 37 Flush tables: 1 Open tables: 30 Queries per second avg: 0.013 --------------
Listing 20
Connect User to Database Server
$ su - mysql $ /opt/freeware/bin/mysql -u mysql mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.4.26-MariaDB Source distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. readline: warning: turning on OPOST for terminal readline: warning: turning on OPOST for terminal MariaDB [mysql]>
At the prompt on the last line, create a database named MARIAIX:
CREATE DATABASE MARIAIX;
To confirm the database was created successfully, list the databases, with SHOW DATABASES;. Type exit; to return to the shell prompt, and type exit (without the semicolon) to return to the root shell prompt (Listing 21).
Listing 21
Displaying Database
MariaDB [mysql]> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | MARIAIX | | information_schema | | mysql | | performance_schema | | test | +--------------------+ 5 rows in set (0.000 sec) MariaDB [mysql]> exit; Bye $ exit #
You can stop the database server with the mysqladmin tool:
mysqladmin -u root -p shutdown
Enter the root password when prompted. However, MariaDB Server is also integrated into the system resource controller (SRC) framework when installed on AIX, meaning you can stop and start it with the built-in AIX commands. You can confirm the mariadb SRC subsystem exists on the system with the command in Listing 22.
Listing 22
MariaDB SRC Subsystem Entry
# lssrc -Ss mariadb#subsysname:synonym:cmdargs:path:uid:auditid:standin:standout:standerr:action:multi:contact:svrkey:svrmtype:priority:signorm:sigforce:display:waittime:grpname:mariadb::-c "ulimit -n unlimited; ulimit -c 10; ulimit -m unlimited; ulimit -d unlimited; /opt/freeware/libexec/mysqld" :/usr/bin/sh:27:0:/dev/console:/dev/console:/dev/console:-O:-Q:-S:0:0:20:15:9:-d:20::
Now start the database server from the AIX SRC and confirm the mariadb subsystem is now active (Listing 23).
Listing 23
Starting MariaDB with AIX Command
# startsrc -s mariadb
0513-059 The mariadb Subsystem has been started. Subsystem PID is 5636486.
# lssrc -s mariadb
Subsystem Group PID Status
mariadb 5636486 active
# ps -fu mysql
UID PID PPID C STIME TTY TIME CMD
mysql 5636486 4129208 0 19:39:27 - 0:00 /opt/freeware/libexec/mysqld
You can stop the DB server and confirm the mariadb subsystem is inoperative (Listing 24). Congratulations, you have just used DNF to install your first open source database application and create and manage a MariaDB database on AIX.
Listing 24
Stopping MariaDB with AIX command
# stopsrc -s mariadb 0513-044 The mariadb Subsystem was requested to stop. # lssrc -s mariadb Subsystem Group PID Status mariadb inoperative
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
