In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Raspberry pie 3 how to install archlinux to configure web, samba and aria2, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
1. Configure web services (based on LAMP)
Rich in English documents: https://wiki.archlinux.org/index.php/Apache_HTTP_Server
1.1 install Apache, PHPpacman-Sy php php-apache php-gd first
[the above command automatically installs Apache and PHP]
Start Apache first to see what mistakes there are.
[root@alarm alarm] # apachectlAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::ba27:ebff:fe34:38d5. Set the 'ServerName' directive globally to suppress this message
Configure apache:
Vi / etc/httpd/conf/httpd.conf
Look for ServerName and you will see # ServerName www.example.com:80. Remove the previous note # and change it to your own hostname. If it is local, you can change it to:
SeverName localhost:80
Https://wiki.archlinux.org/index.php/Apache_HTTP_Server
Find the following line in / etc/httpd/conf/httpd.conf and comment it out:
# LoadModule mpm_event_module modules/mod_mpm_event.so
Find the line below and remove the previous #.
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
To enable PHP, add these lines to / etc/httpd/conf/httpd.conf:
Add the following two sentences at the end of the LoadModule list (mine is after line 185, different versions of the configuration file are different, see for yourself):
LoadModule php7_module modules/libphp7.soAddHandler php7-script .php
Add the following sentence to the end of the Include list:
Include conf/extra/php7_module.conf
Sytemctl restarts the httpd.service service.
Sytemctl httpd.service restart
Test the configuration of PHP: create a test.php file in your Apache DocumentRoot directory (such as / srv/http/ or ~ / public_html), as follows:
You can create it directly with the following command
Echo "" / srv/http/test.php
Pay attention to the file permissions attribute of the directory
Sudo chmod + x-R / srv/http/
Enter in the browser:
Http://localhost/test.php
1.2 install mysql (official default mariadb)
For more information on configuration, please see https://wiki.archlinux.org/index.php/MySQL
Pacman-Sy mariadb
After installing mariadb, don't rush to start the mariadb.service service, run the following command:
Mysql_install_db-user=mysql-basedir=/usr-datadir=/var/lib/mysql
You can now start the mariadb.service service.
Systemctl start mysqld
Then you need to boot the MySQL settings:
Systemctl enable mysqld
Next, set the security for mariadb.
Mysql_secure_installation
Enter the car first, then go down all the way y, during which you need to enter the password of root twice.
Add ordinary user $mysql-u root-pMariaDB > CREATE USER 'monty'@'localhost' IDENTIFIED BY' some_pass';MariaDB > GRANT ALL PRIVILEGES ON mydb.* TO 'monty'@'localhost';MariaDB > FLUSH PRIVILEGES;MariaDB > quitGRANT ALL PRIVILEGES ON *. * TO' bysu'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION;GRANT PROXY ON'@%'TO 'bysu'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES; FLUSH PRIVILEGES
Display authorization information, I am authorized according to root.
SHOW GRANTS FOR 'yangfan'@'localhost';1.3 sets PHP to support mariadb
Uncomment it in the / etc/php/php.ini file (delete the; sign at the beginning of the line):
Extension=pdo_mysql.soextension=mysqli.so
Note: mysql.so has been removed in PHP 7.0.
Test whether php is connected to mariadb. Vi / srv/html/conn.php # create a new conn.php file
Enter the following into the conn.php file.
Curl http://192.168.31.146/conn.php # where 192.168.31.146 is your local ip, please change it yourself
If nothing happens, then you will see the page enter successful
If you need to check the version number of php in the above way (terminal curl command)
Change the content of conn.php above to
Or use the phpversion () function
Refer to the official documentation for other configurations. Here is an excerpt from the official documentation.
1.4 Configuration files
MariaDB configuration options are read from the following files in the given order (according to mysqld-help-verbose output):
/ etc/my.cnf / etc/mysql/my.cnf ~ / .my.cnf
Depending on the scope of the changes you want to make (system-wide, user-only...), use the corresponding file. See this entry of the KnowledgeBase for more information.
Grant remote access
Warning: This is not considered as best practice and may cause security issues. Consider using Secure Shell, VNC or VPN, if you want to maintain the MySQL-server outside and/or inside your LAN.
If you want to access your MySQL server from other LAN hosts, you have to edit the following lines in / etc/mysql/my.cnf:
[mysqld]. # skip-networking bind-address =.
Grant any MySQL user remote access (example for root):
$mysql-u root-p
Check current users with remote access privileged:
SELECT User, Host FROM mysql.user WHERE Host 'localhost'
Now grant remote access for your user (here root)::
GRANT ALL PRIVILEGES ON *. * TO 'root'@'192.168.1.%' IDENTIFIED BY' my_optional_remote_password' WITH GRANT OPTION
You can change the'% 'wildcard to a specific host if you like. The password can be different from user's main password.
Disable remote access
The MySQL server is accessible from the network by default. If MySQL is only needed for the localhost, you can improve security by not listening on TCP port 3306. To refuse remote connections, uncomment the following line in / etc/mysql/my.cnf:
Skip-networking
You will still be able to log in from the localhost.
two。 Install samba-- to build NAS
Install samba
Sudo pacman-S samba
View the status of samba
[bysu@centos-rpi3 ~] $sudo systemctl status samba
The samba service is set to boot
Systemctl enable smbsystemctl start smb # start samba service systemctl restart smb # restart samba service systemctl stop smb # stop samba service
Use testparm to test whether the samba configuration is correct
Testparm
Test on Linux
Smbclient-L localhost # root account does not need a password
To create a samba user, you can use the original Linux user
Smbpasswd-a bysu
Create a shared directory
[root@base samba] # mkdir-p / smb/ {guest,bysu} [root@base samba] # chown nobody:nobody / media/samba/guest/ [root@base samba] # chown bysu:bysu / media/samba/bysu/
Pay attention to setting the properties, otherwise you will not be able to access them.
Configure the profile for samba
Detailed explanation of sudo vi / etc/samba/smb.confSamba configuration file, copied from
The configuration file / etc/samba/smb.conf of Samba is divided into two parts, one is [global], that is, global configuration, and the other is [home], [printer] and [custom shared name]. These are all shared parts, and the setting priority of the shared part is higher than the global configuration. In addition, Samba enables the sharing of local user home directory [home] and printer [printer] by default. If you don't need it, you can close the two shares, and then recreate a share on the last line. Here are the detailed configurations. You can customize a share, and then choose which configurations you need:
[pzk] # Custom share name comment = Home Directories # descriptor, which is shown to the system administrator whether the path to the share public = yes # is public or not That is, whether the shared browseable = yes # shared directory is visible to everyone on the network neighbor, writable = yes # whether writable guest ok = no # whether anonymous access is denied, effective only when the security level is share workgroup = WORKGROUP # workgroup To be set to be consistent with Windows's workgroup server string = Samba Server Version% v # the prompt netbios name = MYSERVER # when other Linux hosts view the share is used for the hostname hosts allow = 127displayed on Windows network neighbors. 192.168.12. 192.168.13. EXCEPT 192.168.13.13 # specifies the hosts that are allowed to access the samba server security = share # defines the security level log file = / var/log/samba/log.%m # defines the log file, and each host that accesses generates a separate log file % m is the client hostname max log size = 50 # defines the maximum capacity of a single log (KB) passdb backend = tdbsam # Samba user storage mode, smbpasswd means plaintext storage, tdbsam means ciphertext storage deadtime = 10 # client has not opened any Samba resources within 10 minutes, and the server will automatically close the session In a large number of concurrent access environments, this setting can improve server performance display charset = UTF8 # set the character set displayed max connections = 0 # set the maximum number of connections, 0 means unlimited If the maximum number of connections is exceeded, the connection is denied guest account = nobody # set the anonymous account to nobodyload printers = yes # whether to share the printer cups options = raw # set the way the printer is used valid users = user1 user2 user3 # specify which users can access If not specified, all users can access invalid users = user1 user2 # specify which users cannot access create mask = 0775 # default permissions for client to upload files directory mask = 0775 # default permissions for client to create directories write list = user1 user2 user3 # setting for files to enter The user of the line write operation admin users = user1 # sets the administrator of the shared directory With full permission security level: share: means anonymous user, can log in to samba server without samba account user: system account needs to be added to samba library and then becomes samba user, login using samba user is simply required to log in to server with user password: another samba server is used to authenticate users domain: join samba server to NT domain Authentication is carried out by the domain controller of NT: (Active Directory Service, active directory service), which is a new authentication method in samba3.0. Using ADS authentication, the samba server is integrated into the download and installation of 3.aria2 in the active directory and configure sudo pacman-S aria2.
Create aria2.conf and aria2.session
Sudo vi / etc/aria2.confsudo vi / etc/aria2.session
Edit the file aria2.con and write the following
# dir=/data/download # download the file to save the directory, it is recommended to mount the mobile hard drive, SD card can not stand this game # because we are pi users to execute the aria2c process So here is the read and write permission of this directory # sudo chown-R pi:pi / data/download # the purpose of opening rpc is to give the web manager a maximum number of retries with # configuration file for aria2cenable-rpc=truerpc-allow-origin-all=truerpc-listen-all=true # rpc-listen-port=6800file-allocation=nonedisable-ipv6=truedisk-cache=32M plit=3 max-concurrent-downloads=3 max-connection-per-server=3 max-file-not-found=3 # # 0 means you can retry max-tries=5 retry-wait=3 continue=true check-integrity=true log-level=error log=/var/log/aria2.log input-file=/etc/aria2/aria2.session save-session=/etc/aria2/aria2.session dir=/media/pi/bysu indefinitely.
Create an aria2.service file (boot file)
Sudo vi / usr/lib/systemd/system/aria2.service# add the following [Unit] Description=Aria2 ServiceAfter= network.target [service] ExecStart=/usr/bin/aria2c-- enable-rpc-- rpc-listen-all-- rpc-allow-origin-all-- save-session / etc/aria2/aria2.session-- input-file / etc/aria2/aria2.session-- conf-path=/etc/aria2/aria2.conf#ExecStart=/usr/bin/aria2c-- enable-rpc-- rpc-listen-all-- Rpc-allow-origin-all-- save-session% h/.config/aria2/session.lock-- input-file% h/.config/aria2/session.lock-- conf-path=%h/.config/aria2/ Aria2.confs [install] WantedBy=default.target
Start the aria2 service
Sudo systemctl start aria2# is set to boot sudo sytemctl enable aria2
Terminal input:
Aria2c-- enable-rpc-- rpc-listen-all # enable snooping RPC
Install the page-side webui of aria2
Cd / srv/htmlgit clone https://github.com/ziahamza/webui-aria2.git
You can see the interface of http://pi by accessing the IP address or hostname of webui with a browser, and you can add download task testing to this interface.
Install the plug-in "Baidu Cloud Export to aria2" on the chrome browser on your computer to facilitate the direct addition of files on Baidu cloud disk to aria2 on your computer. The plug-in download address is:
Https://github.com/acgotaku/BaiduExporter
After the initial installation, you need to configure the aria2 PRC address, which is generally
Http://192.168.31.42/webui-aria2/index.html
When you are finished, use the export button to test the effect:
Add scripts that are downloaded regularly
Cd / etc/aria2wget https://github.com/bostoneboy/raspberry_pi_stuff/raw/master/aria2/aria2_auto.pycrontab-e * / usr/bin/python2 / etc/aria2/aria2_auto.py
The function of this script is to suspend all downloading tasks at 6 pm every day, and start all downloading tasks at 3 am every day, that is, the offline download function will be enabled at work and in the wee hours of the morning, and you can modify the script as needed.
Upload Baidu cloud disk on aria2-to be continued
(the content of this node refers to "Open Source hardware Creator. 15 cool apps play raspberry pie" and Chaowen Road)
Because you use the python script, you need to configure the relevant environment (if you have python installed, you can refer to my previous tutorial if necessary).
Install pip.
Sudo pacman-Syyu # Update system sudo pacman-S python-pip # install python's pip package management tool sudo pip install rpi.gpio # install python's GPIO library sudo pip install requests # install python's Requests library
Download Baidu Cloud python client
Sudo git clone https://github.com/lyhonk/bypy.git # my authorization is not successful in this way, or I can install bypysudo pip install bypy through pip # by installing it in this way, my license is successful
After the download is complete, go to the bypy directory
Cd bypy
Execution
Sudo python bypy.py info
If the following error is reported, you need to change the coding of the system
[bysu@alarm bypy] $sudo python bypy.py-m info! ! WARNING: Can't detect the system encoding Assume it's' UTF-8'.Files with non-ASCII names may not be handled roomy.! !! [bysu@alarm bypy] $sudo vi / etc/locale.confLANG= "zh_CN.UTF-8" LANGUAGE= "zh_CN:en_GB:en" [bysu@alarm bypy] $sudo locale-gen
After changing the system code, continue to run
[bysu@alarm bypy] $sudo python bypy.py infoPlease visit: https://openapi.baidu.com/oauth/2.0/authorize?client_id=q8WE....lgMKNBn&response_type=code&redirect_uri=oob&scope=basic+netdiskAnd authorize this appPaste the Authorization Code here within 10 minutes.Press [Enter] when you are done
If it still doesn't work to modify the code of the system, you can try to set the python code as follows. Take a look at the python code first. You can see that the code used is always the same as the code prompted above, which is always ANSI_X3.4-1968.
Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linuxType "help", "copyright", "credits" or "license" for more information. > > import locale > locale.getpreferredencoding () 'ANSI_X3.4-1968' > > import sys > sys.getfilesystemencoding () 'ascii' >
It can be set through export, but I heard that only the current environment is valid, so I dealt with it temporarily in this way.
Export PYTHONIOENCODING=UTF-8
Online persistent solution for python2.7, python3.3+ has not found a solution, I can think of a solution is to temporarily change the default python version of the system to python2.7.
Create a new file sudo vi / usr/lib/python2.7/site-packages/sitecustomize.py in the python2.7 directory with the following contents: import sysreload (sys) sys.setdefaultencoding ('utf8')
Log in to your Baidu cloud disk in the browser, then create a new tag and put the above
The content of the https://openapi.baidu.com...basic+netdisk line (link), access in the address bar of the new browser tag, get a string of authorization codes, and enter in the linux terminal just now, enter. You can see the total capacity and usage space of successfully and cloud disk.
Authorizing,please be patient,it may take upto None seconds...Authorizing/refreshing with the OpenShift server...OpenShift server failed,authorizing/refreshing with the Heroku server...Successfully authorizedQuota:3.011TBUsed:2.928TB
If you are prompted about the authorization, you can run bypy.py-c, delete the token file, and then re-authorize it again. If not, delete bypy from Baidu App Authorization and then re-authorize it.
After uploading to Baidu cloud disk, you can check the directory of the cloud disk.
/ my application data / bypy
At this point, it's about the same. Recently stayed up a lot of late, in order to avoid sudden death, put it down for a while!
This is the answer to the question about how to install archlinux, configure web and samba, and aria2 in Raspberry Pie 3. I hope the above content can be of some help to you. If you still have a lot of questions to solve, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.