Remote management project deployment (lamp) @Author:Tim Lu
Switch to root user
su Switch to root user
Modify Ubuntu's apt-get source to a domestic mirror source
Backup original files
cp /etc/apt/sources.list /etc/apt/sources .list.bak
2 Edit the source list file (recommended to use Alibaba Cloud Source)
vim /etc/apt/sources.list
Copy any of the following to sources.list and overwrite the original file content
deb-src http:/ /archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http: // mirrors. aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http: //mirrors.aliyun .com / ubuntu / xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com / ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http:/ /mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
update command
apt-get update
Deploy lamp operating environment
Install extension PHP
Ubuntu 16.04 installs php7.0 by default environment, but the compatibility of php7 is not very good at present. If you install php5.6 by yourself, you need to clear the installed package of php7, otherwise an error will be reported
dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
apt-get install aptitude
aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " " `
Add PPA
add-apt-repository ppa:ondrej/php
If it prompts that add-apt-repository cannot be found:
first install
apt-get install python-software-properties
and then install
apt-get install software-properties-common
and then execute the above installation command.
Install php5.6 and other libraries Install
apt-get update
apt-get install php5.6
apt-get install php5.6-gd
apt-get install php5.6-dev
apt-get install php5.6-zip
Test: php - vInstall
Apache2
apt install apache2
apt-get install libapache2-mod-php5.6
Test: The browser accesses the IP of http://Ubuntu, and the It Works! web page appears.
Check status: service apache2 status/start/stop/restart
Web directory: /var/www
Installation directory: /etc/apache2/
Global configuration: /etc/apache2/apache2.conf
Listening port: /etc/apache2/ports.conf
Virtual host: /etc/apache2/sites-enabled/000-default.conf
Install MySQL
apt-get install mysql-server mysql- client
apt-get install php5.6-mysql
mysql_secure_installation
Initial account: root Password: 123456
Test: mysql -u root -p
Check the status: service mysql status/start/stop/retart
Check the status of the listening port: netstat -tunlp or netstat - Tap to restart the
service
service apache2 restart
service mysql restart
Test whether Apache can parse the PHP
vim /var/www/html/phpinfo.php
file: <?php echo phpinfo();?>
Browser access: http://ubuntu address /phpinfo.php, the PHP Version page appears
Other extension libraries installation and configuration
Redis installation Redis installation
and support php
apt-get install redis-server
apt-get install php5.6-redis
After the installation is complete, the Redis server will start automatically, we check the Redis server program to
check the status: service redis- server status/start/stop/restart
Configure redis multi-port, add port 6380
Configure port
The default startup port of redis-server is 6379, and the default configuration file /etc/redis/redis.conf is used.
For example, port 6380 should be opened now. , first copy the default configuration file for redis_6380:
cp
/etc/redis/redis.conf /etc/redis/redis_6380.conf Edit the redis_6380.conf file:
vim /etc/redis/redis_6380.conf
Modify the following content:
pidfile /var /run/redis/redis-server6380.pid
port 6380
logfile /var/log/redis/redis-server6380.log
dbfilename dump6380.rdb
is saved, start the configuration file
redis-server /etc/redis/redis_6380.conf to
view the redis running process
ps -ef | grep redis
redis two ports 6379 and 6380 running process
test
redis-cli -p 6379
redis- cli -p 6380
Curl install
apt-get install curl
Composer install
apt-get install composer
Zip install
apt-get install zip
Remote management: remote_manage_system project deployment
Delete the html folder in
/var/www/ rm -rf /var/www/html The /
clone project file
puts remote_manage_system and database in /var/www/ and
executes the database file
. Execute the mythware_remote.sql file in the database to create the database.
Modify the default access folder of apache2 to access the remote management project.
1: Access the remote management system and directly access the IP address:
vi /etc/apache2/sites-available/000-default.conf
Modify
DocumentRoot /var/www/html
to
DocumentRoot /var/www/dist
2: Back-end API access address Need to add second-level domain name remote
vi /etc/apache2/apache2.conf
Find
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
and add
Alias /remote /var/www/remote_manage_system/public/
< Directory /var/www/remote_manage_system/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
3: Restart apache2
service apache2 restart to enter the root directory
of the project (remote_manage_system) : 1: Modify the env file cp .env.example .env Modify mysql, redis configuration information vi .env DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE =mythware_remote DB_USERNAME=root DB_PASSWORD=123456 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6380 ..... remote_api_url=http://192.168.0.240/remote/ vswitch_server_url=192.168.0.253 vswitch_server_port=8022
vswitch_redis_server_url=192.168.0.253
vswitch_redis_server_port=6379
dm_valid_url=192.168.0.240:7000/api/deviceinfo
dm_account=admin
dm_password=Mythware123
2: Unzip vendor.zip folder
unzip vendor.zip
rm vendor.zip
3: Modify storage/bootstrap/cache /public/ These three folders have read and write permissions
chmod -R a+w storage/
chmod -R a+w bootstrap/cache
chmod –R a+w public/
4: Under the project root directory: the extension library will be added to the ext folder Update to php class library
cp /var/www/remote_manage_system/ext/* /usr/lib/php/20131226/
php environment class library directory: /usr/lib/php/20131226/
Update php.ini, load ext library
vi /etc/php/5.6/apache2/php.ini
found ;extension=php_xsl.dll Add
extension=remoteproto.so
extension=vswitch.so to
restart apache to take effect
service apache2 restart
to access the project
Directly access the current Ubantu IP address
1: Support laravel URL rewriting
a2enmod rewrite
2: Remove index.php in access url Support .htaccess
vi /etc/apache2/apache2.conf
Add
<Directory /var/www/>
Options FollowSymLinks
AllowOverride none
Require all granted
</Directory>
to
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
3: Restart apache2
service apache2 restart
5: Start crotab, modify scheduled tasks, regularly update device online, offline status
crontab -e
check device online status, update device online and offline, every three Execute every second, add the following:
*/1 * * * * /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 3 && /usr/bin/php /var /www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 6 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 9 && /usr/bin /php /var/www/remote_manage_system/artisan-laravel:academy
*/1 * * * * sleep 12 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 15 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 18 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 21 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 24 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 27 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 30 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 33 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 36 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 39 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 42 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 45 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 48 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 51 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 54 && /usr/bin/php /var/www/remote_manage_system/artisan laravel:academy
*/1 * * * * sleep 57 && /usr/bin/php /var/www/remote_manage_system/ artisan laravel:academy
restart crontab
service cron restart
6: start the workerman process, the socket server
enters the project folder
cd /var/www/remote_manage_system/
php artisan wk start
Remote Management Project Deployment (lamp) @Author:Tim Lu
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326098863&siteId=291194637
Ranking