How to Install TestLink on CentOS 7

前端之家收集整理的这篇文章主要介绍了How to Install TestLink on CentOS 7前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

TestLink is an open-source web based test management execution system. It enables quality assurance teams to create and manage their test cases as well as to organize them into test plans. These test plans allow team members to execute test cases and track test results dynamically.

In this tutorial,we will be installing TestLink version1.9.16(the latest version at the time this article was written) on CentOS 7.

Prerequisites

  • A CentOS 7 x64 server instance.
  • Asudo user.

I'll reference the main IP of my CentOS 7 server as203.0.113.1.

Step 1: Update the system

Log in to your server via SSH using the sudo user to installepel,update the system,and restart to apply the updates.

sudo yum install epel-release -y
sudo yum update -y && sudo shutdown -r now

Step 2: Install a web server—Apache

sudo yum install httpd -y

It is recommended to remove/disable the Apache default welcome page in production environments.

sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Prevent Apache from listing web directory files to visitors:

sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Start the Apache service and enable it to auto-start on boot

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install database software—MariaDB 10.1

As required by TestLink 1.9.16,you need to install MariaDB 10.1 or later on your system.

3.1 Create the MariaDB 10.1 YUM repo file

cat <<EOF | sudo tee -a /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list - created 2017-01-14 03:11 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

3.2 Install MariaDB 10.1 using YUM

sudo yum install MariaDB-server MariaDB-client -y

3.3 Start the MariaDB service and set it as running at system startup

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

3.4 Secure the MariaDB installation

sudo /usr/bin/MysqL_secure_installation

Answer questions on the screen as instructed below,and remember to use your own MariaDB root password:

  • Enter current password for root (enter for none): Just press theEnterbutton
  • Set root password? [Y/n]:Y
  • New password:your-root-password
  • Re-enter new password:your-root-password
  • Remove anonymous users? [Y/n]:Y
  • Disallow root login remotely? [Y/n]:Y
  • Remove test database and access to it? [Y/n]:Y
  • Reload privilege tables now? [Y/n]:Y

3.5 Create a MariaDB database for TestLink

Log into the MysqL shell asroot:

MysqL -u root -p

Type the MariaDB root password you set earlier and then pressEnter.

In the MysqL shell,create a databasetestlink,a database usertestlinkuser,and the database user's passwordyourpasswordas follows.

Note: For security purposes,remember to replace the sample passwordyourpasswordwith your own password.

CREATE DATABASE testlink;
CREATE USER 'testlinkuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON testlink.* TO 'testlinkuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Step 4: Install PHP 7.1 and some extensions

TestLink requires PHP 5.5 or later. In order to get better performance,we will install PHP 7.1 and all the necessary extension for TestLink as follows:

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install mod_PHP71w PHP71w-MysqLnd PHP71w-common PHP71w-gd PHP71w-ldap PHP71w-cli PHP71w-mcrypt PHP71w-xml -y

We will need to modify PHP settings to meet TestLink’s requirements as follows:

sudo cp /etc/PHP.ini /etc/PHP.ini.bak
sudo sed -i "s/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 2880/" /etc/PHP.ini
sudo sed -i "s/max_execution_time = 30/max_execution_time = 120/" /etc/PHP.ini

Step 5: Install TestLink 1.9.16

5.1 Download the TestLink 1.9.16 archive from the official TestLink GitHub repo,and then unzip the archive to the/var/www/htmldirectory:

cd
wget https://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/1.9.16.tar.gz
sudo tar -zxvf 1.9.16.tar.gz -C /var/www/html
sudo chown -R apache:apache /var/www/html/testlink-code-1.9.16

5.2 Create a custom configuration file for TestLink:

sudo cp /var/www/html/testlink-code-1.9.16/custom_config.inc.PHP.example /var/www/html/testlink-code-1.9.16/custom_config.inc.PHP

5.3 Modify the custom TestLink configuration file:

Use thevitext editor to open this configuration file:

sudo vi /var/www/html/testlink-code-1.9.16/custom_config.inc.PHP

Find the following lines:

// $tlCfg->log_path = '/var/testlink-ga-testlink-code/logs/'; /* unix example */
// $g_repositoryPath = '/var/testlink-ga-testlink-code/upload_area/';  /* unix example */

Replace them with:

$tlCfg->log_path = '/var/www/html/testlink-code-1.9.16/logs/';
$g_repositoryPath = '/var/www/html/testlink-code-1.9.16/upload_area/';

Save and quit:

:wq!

5.4 Create a virtual host for TestLink:

cat <<EOF | sudo tee -a /etc/httpd/conf.d/testlink.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/testlink-code-1.9.16/
ServerName testlink.example.com
ServerAlias www.testlink.example.com
<Directory /var/www/html/testlink-code-1.9.16/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/testlink.example.com-error_log
CustomLog /var/log/httpd/testlink.example.com-access_log common
</VirtualHost>
EOF

5.5 Restart Apache in order to apply all above settings:

sudo systemctl restart httpd.service

5.6 Modify firewall rules in order to allow web access:

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

5.7 Finishing the installation

When you visithttp://203.0.113.1for the first time,you will be presented with the TestLink installation wizard.

On the first page,Click theNew installationlink.

On theAcceptance of Licensepage,checkI agree to the terms set out in this license.,and then click theContinuebutton.

Verification of System and configuration requirementspage,make sure that all requirements (excluding requirements onPostgresandMSsql) are satisfied,244); border-width:0px">Database Configurationpage,provide database configuration info as follows,244); border-width:0px">Process TestLink Setupbutton to finish the installation:

  • Database Type:MysqL/MariaDB (5.6+ / 10.+)
  • Database host:localhost
  • Database name:testlink
  • Table prefix:<LEAVE IT EMPTY>
  • Database admin login:root
  • Database admin password:<your-MariaDB-root-password>
  • TestLink DB login:testlinkuser
  • TestLink DB password:yourpassword

You can point your web browser tohttp://203.0.113.1to start using TestLink,and you need to use the default credentials below to log in:

  • Login Name:admin
  • Password:admin

Note: Remember to change your password after logging in.

5.8 Security measures after the installation:

For security purposes,you should restrict theapacheuser's permissions after the installation:

sudo chown -R root:root /var/www/html/testlink-code-1.9.16
sudo chown -R apache:apache /var/www/html/testlink-code-1.9.16/{gui,logs,upload_area}
sudo systemctl restart httpd.service

Additionally,you should remove the/var/www/html/testlink-code-1.9.16/installdirectory:

sudo rm -rf /var/www/html/testlink-code-1.9.16/install

That's it. Thanks for reading.

原文链接:https://www.f2er.com/centos/376633.html

猜你在找的CentOS相关文章