From Fedora Project Wiki

No edit summary
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{header|qa}}
{{header|qa}}
{{draft}}


=Installation=
=Installation=
Line 20: Line 18:




Once the proper yum repositories are configured, use the {{command|yum}} command to install ''yourls'' and it's dependencies.
Once the proper dnf|yum repositories are configured, use the [[dnf|DNF]] or [[yum|YUM]] command to install ''yourls'' and it's dependencies.
<pre> yum install yourls</pre>
<pre> dnf install yourls
yum install yourls</pre>


=Configuration=
=Configuration=
Line 28: Line 27:


==mysql==
==mysql==
{{admon/important|These instructions assume that MySQL is installed and running on the target system}}
{{admon/important|MySQL Installation|These instructions assume that MySQL is installed and running on the target system}}


Connect to MySQL as root
Connect to MySQL as root
Line 42: Line 41:
==httpd==
==httpd==


=== Change the YOURLS Location (Optional) ===
=== Change the YOURLS Location ===
The default location for YOURLS is <code>http://yourserver/yourls</code> and while there is nothing wrong with using that default, you may want to change it.
The default location for YOURLS is <code>http://your_server/yourls</code>. For AutoQA purposes we want to change <code>/yourls</code> directory to <code>/report</code> directory. The rest of this guide will reflect that.


The httpd configuration file is located at <code>/etc/httpd/conf.d/yourls.conf</code> . Assuming that you want to have YOURLS accessed from <code>http://yourserver/newlocation</code>, edit that file to match:
The httpd configuration file is located at <code>/etc/httpd/conf.d/yourls.conf</code>. Edit that file to match:
<pre>
<pre>
Alias /newlocation /usr/share/yourls
Alias /report /usr/share/yourls


<Directory /usr/share/yourls>
<Directory /usr/share/yourls>
   AllowOverride All
   AllowOverride All
</Directory>
</pre>
There is a change in configuration files in Apache 2.4, therefore, on Fedora 18 edit <code>/etc/httpd/conf.d/yourls.conf</code> to match:
<pre>
Alias /report /usr/share/yourls
<Directory /usr/share/yourls>
  Options All
  AllowOverride All
  Require all granted
</Directory>
</Directory>
</pre>
</pre>


=== Add the ModRewrite Configuration File ===
=== Add the ModRewrite Configuration File ===
{{admon/note|Make sure that the .htaccess directives match your YOURLS configuration - replace 'yourls' for the location set above}}
YOURLS relies on mod_rewrite directives in a .htaccess file in order to process the shortened URLs into the actual URL. Edit or create <code>/usr/share/yourls/.htaccess</code> to contain:
YOURLS relies on mod_rewrite directives in a .htaccess file in order to process the shortened URLs into the actual URL. Edit or create <code>/usr/share/yourls/.htaccess</code> to contain:


Line 62: Line 71:
<IfModule rewrite_module>
<IfModule rewrite_module>
RewriteEngine On
RewriteEngine On
RewriteBase /yourls/
RewriteBase /report/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourls/yourls-loader.php [L]
RewriteRule ^(.*)$ /report/yourls-loader.php [L]
</IfModule>
</IfModule>
# END YOURLS
# END YOURLS
Line 76: Line 85:
=== MySQL Settings ===
=== MySQL Settings ===
The ''YOURLS_DB_USER'', ''YOURLS_DB_PASS'', ''YOURLS_DB_NAME'' and ''YOURLS_DB_HOST'' need to match your actual settings, set them to your actual MySQL user name, password, MySQL database name and MySQL database host.
The ''YOURLS_DB_USER'', ''YOURLS_DB_PASS'', ''YOURLS_DB_NAME'' and ''YOURLS_DB_HOST'' need to match your actual settings, set them to your actual MySQL user name, password, MySQL database name and MySQL database host.
<pre>
/** MySQL database username */
define( 'YOURLS_DB_USER', 'your db user name' );
/** MySQL database password */
define( 'YOURLS_DB_PASS', 'your db password' );
/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', 'yourls' );
/** MySQL hostname */
define( 'YOURLS_DB_HOST', 'localhost' );
</pre>


=== Site Configuration ===
=== Site Configuration ===
The ''YOURLS_SITE'' needs to match the '''EXTERNAL''' URL of the installation that will be used by people clicking on shortened URLs.
The ''YOURLS_SITE'' needs to match the '''EXTERNAL''' URL of the installation that will be used by people clicking on shortened URLs.
<pre>
/** YOURLS installation URL, no trailing slash */
define( 'YOURLS_SITE', 'http://your_server/report' );
</pre>


=== YOURLS Users ===
=== YOURLS Users ===
Line 84: Line 112:
<pre>
<pre>
$yourls_user_passwords = array(
$yourls_user_passwords = array(
         'user1' => 'password1',
         'username' => 'password',
         'user2' => 'password2',
         'username2' => 'password2',
         );
         );
</pre>
</pre>


== Final Configuration ==
== Final Configuration ==
To finish the configuration, restart httpd <code>systemctl restart httpd.service</code> (or <code>service httpd restart</code> on RHEL or older Fedora systems).
To finish the configuration, restart httpd: <code>systemctl restart httpd.service</code>.


Point a browser to your installation location (http://localhost/yourls by default) and complete the WEB GUI based installation process. After this, the YOURLS instance is ready for business - you can access the API at http://localhost/yourls/yourls-api.php or the web admin GUI at http://localhost/yourls/admin/ .
Point a browser to your installation location (http://localhost/report/admin/ by default) and complete the WEB GUI based installation process. After this, the YOURLS instance is ready for business - you can access the API at http://localhost/report/yourls-api.php or the web admin GUI at http://localhost/report/admin/.


[[Category:AutoQA]]
[[Category:AutoQA]]

Latest revision as of 10:00, 8 October 2015

Installation

This documents the process of installing and configuring YOURLS for use with AutoQA.

Use the right repos

Yourls requires EPEL if running on RHEL or CentOS.

  1. If using RHEL or CentOS, configure the system to receive package updates using the update mechanism provided by the distribution (e.g. for RHEL, run rhn_register).
  2. If using RHEL or CentOS, enable EPEL by following the instructions at EPEL/FAQ#howtouse
  3. Add the same repositories as mentioned in the AutoQA installation guide.

Install the Package

Once the proper dnf|yum repositories are configured, use the DNF or YUM command to install yourls and it's dependencies.

 dnf install yourls
 yum install yourls

Configuration

There are three parts to configuring YOURLS: creating the database, setting up the httpd configuration and internal YOURLS configuration.

mysql

MySQL Installation
These instructions assume that MySQL is installed and running on the target system

Connect to MySQL as root

 mysql -u root -p

Create the 'yourls' database and grant privileges to the 'yourls' user (using a password other than 'NEWPASSWORD' is highly recommended).

create database yourls;
GRANT ALL on yourls.* TO 'yourls'@'localhost' identified by 'NEWPASSWORD';
flush privileges;

httpd

Change the YOURLS Location

The default location for YOURLS is http://your_server/yourls. For AutoQA purposes we want to change /yourls directory to /report directory. The rest of this guide will reflect that.

The httpd configuration file is located at /etc/httpd/conf.d/yourls.conf. Edit that file to match:

Alias /report /usr/share/yourls

<Directory /usr/share/yourls>
  AllowOverride All
</Directory>

There is a change in configuration files in Apache 2.4, therefore, on Fedora 18 edit /etc/httpd/conf.d/yourls.conf to match:

Alias /report /usr/share/yourls

<Directory /usr/share/yourls>
  Options All
  AllowOverride All
  Require all granted
</Directory>

Add the ModRewrite Configuration File

YOURLS relies on mod_rewrite directives in a .htaccess file in order to process the shortened URLs into the actual URL. Edit or create /usr/share/yourls/.htaccess to contain:

# BEGIN YOURLS
<IfModule rewrite_module>
RewriteEngine On
RewriteBase /report/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /report/yourls-loader.php [L]
</IfModule>
# END YOURLS

YOURLS

Now that the backing services have been setup and configured, we need to set up YOURLS itself.

Open the YOURLS configuration file /etc/yourls/config.php and make the following changes:

MySQL Settings

The YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME and YOURLS_DB_HOST need to match your actual settings, set them to your actual MySQL user name, password, MySQL database name and MySQL database host.

/** MySQL database username */
define( 'YOURLS_DB_USER', 'your db user name' );

/** MySQL database password */
define( 'YOURLS_DB_PASS', 'your db password' );

/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', 'yourls' );

/** MySQL hostname */
define( 'YOURLS_DB_HOST', 'localhost' );

Site Configuration

The YOURLS_SITE needs to match the EXTERNAL URL of the installation that will be used by people clicking on shortened URLs.

/** YOURLS installation URL, no trailing slash */
define( 'YOURLS_SITE', 'http://your_server/report' );

YOURLS Users

Users for YOURLS are configured in the same configuration file. Add users and passwords to the configuration to match the existing example format:

$yourls_user_passwords = array(
        'username' => 'password',
        'username2' => 'password2',
        );

Final Configuration

To finish the configuration, restart httpd: systemctl restart httpd.service.

Point a browser to your installation location (http://localhost/report/admin/ by default) and complete the WEB GUI based installation process. After this, the YOURLS instance is ready for business - you can access the API at http://localhost/report/yourls-api.php or the web admin GUI at http://localhost/report/admin/.