在Arch Linux上使用Makepkg
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
YOURLS(您自己的URL缩短器)是一个开源URL缩短和数据分析应用程序。
在本文中,我们将介绍在CentOS 7服务器上安装YOURLS的过程。
example.com指向您的服务器的IP地址。以sudo用户身份登录,然后使用以下命令更新系统:
sudo yum install epel-release -y
sudo yum clean all && sudo yum update -y && sudo shutdown -r now
重新引导后,使用相同的sudo用户重新登录到服务器。
使用YUM安装Apache Web服务器:
sudo yum install httpd -y
删除Apache欢迎页面:
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
阻止Apache在访问者的Web浏览器中公开文件:
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
启动Apache服务,并将其设置为在系统启动时自动启动:
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
如下安装MariaDB的最新稳定版本MariaDB 10.1:
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
sudo yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo /usr/bin/mysql_secure_installation
回答以下问题,并确保您将使用自己的MariaDB root密码:
Enter按钮Yyour-root-passwordyour-root-passwordYYYY登录到MySQL shell root:
mysql -u root -p
输入您自己的MariaDB根密码,然后按Enter。
在MySQL Shell中,创建数据库yourls,数据库用户yourlsuser和数据库用户的密码yourpassword,如下所示。
注意:为了安全起见,您应该使用自己的用户密码,而不是示例密码yourpassword。
CREATE DATABASE yourls DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
CREATE USER 'yourlsuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON yourls.* TO 'yourlsuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
安装PHP 7.1和几个PHP 7.1扩展,如下所示:
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y mod_php71w php71w-mysqlnd php71w-common
sudo yum install git -y
cd /var/www/html/
sudo git clone https://github.com/YOURLS/YOURLS.git
sudo chown -R apache:apache /var/www/html/YOURLS
cd YOURLS
sudo cp user/config-sample.php user/config.php
sudo chown apache:apache user/config.php
使用vi文本编辑器打开/var/www/html/YOURLS/user/config.php文件:
sudo vi user/config.php
找到以下几行:
define( 'YOURLS_DB_USER', 'your db user name' );
define( 'YOURLS_DB_PASS', 'your db password' );
define( 'YOURLS_DB_NAME', 'yourls' );
define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );
$yourls_user_passwords = array(
'username' => 'password',
如下一一替换:
define( 'YOURLS_DB_USER', 'yourlsuser' );
define( 'YOURLS_DB_PASS', 'yourpassword' );
define( 'YOURLS_DB_NAME', 'yourls' );
define( 'YOURLS_SITE', 'http://example.com' );
define( 'YOURLS_COOKIEKEY', 'fmoi4jfsjfasfjlkfjalfgcggjkihdgfjjgdfolsfmwemlgjhgigjgitjaaewesfsdfsdogmbnsin' ); // Use a long string consists of random characters.
$yourls_user_passwords = array(
'username1' => 'password1', // Use your own username and password.
保存并退出:
:wq!
cat <<EOF | sudo tee -a /etc/httpd/conf.d/yourls.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/YOURLS/
ServerName yourls.example.com
ServerAlias www.yourls.example.com
<Directory /var/www/html/YOURLS/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/yourls.example.com-error_log
CustomLog /var/log/httpd/yourls.example.com-access_log common
</VirtualHost>
EOF
sudo systemctl restart httpd.service
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
将您的Web浏览器指向http://example.com/admin,然后单击Install YOURLS链接以完成安装。
成功安装YOURLS后,单击YOURLS Administration Page链接访问YOURLS Admin界面,然后使用用户名username1和密码password1登录。
为了安全起见,安装后应将权限限制为YOURLS:
sudo chown -R root:root /var/www/html/YOURLS
当需要升级程序或安装插件时,可以为此还原严格的权限,如下所示:
sudo chown -R apache:apache /var/www/html/YOURLS
我们的教程到此结束。谢谢阅读。
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
快速学习如何在Ubuntu 16.04上安装OpenSIPS控制面板,为VoIP提供商提供支持的功能。
学习如何在Fedora 28上安装Akaunting,一款适合小型企业和自由职业者的开源会计软件。
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
了解導致Minecraft延遲的原因和解決方案,包括優化伺服器性能和減少滯後的步驟。
勒索軟件攻擊呈上升趨勢,但人工智能能否幫助應對最新的計算機病毒?AI 是答案嗎?在這裡閱讀知道是 AI 布恩還是禍根
ReactOS,一個開源和免費的操作系統,這裡有最新版本。它能否滿足現代 Windows 用戶的需求並打倒微軟?讓我們更多地了解這種老式但更新的操作系統體驗。
Whatsapp 終於為 Mac 和 Windows 用戶推出了桌面應用程序。現在您可以輕鬆地從 Windows 或 Mac 訪問 Whatsapp。適用於 Windows 8+ 和 Mac OS 10.9+
閱讀本文以了解人工智能如何在小型公司中變得流行,以及它如何增加使它們成長並為競爭對手提供優勢的可能性。
最近,Apple 發布了 macOS Catalina 10.15.4 補充更新以修復問題,但似乎該更新引起了更多問題,導致 mac 機器變磚。閱讀這篇文章以了解更多信息