Giới thiệu
Vừa rồi OpenLite Speed vừa ra mắt một sản phẩm có tên là LiteSpeed Web ADC để tìm hiểu sâu hơn về dịch vụ này bao gồm các chức năng gì, tốt như thế nào bạn có thể xem bài viết riêng tại link bên dưới, ở bài này mình chỉ hướng dẫn cài đặt LiteSpeed Web ADC
- LiteSpeed Web ADC là gì?
Cài đặt phải được thực hiện trong một thiết bị đầu cuối dòng lệnh. Đối với mục đích thử nghiệm, LiteSpeed Load Balancer có thể được cài đặt vào thư mục chính của bạn với tư cách là người dùng không có đặc quyền. Để sử dụng sản xuất, nó nên được cài đặt vào một thư mục hệ thống. Trong Mac OS X, người dùng root bị tắt theo mặc định; nó có thể được kích hoạt bằng cách sử dụng ứng dụng NetInfo Manager Application in /Applications/Utilities. Nếu bạn không muốn kích hoạt người dùng root, bạn cũng có thể sử dụng cài đặt hệ thống tải về LiteSpeed Load Balancer vào thư mục hệ thống.
Download LiteSpeed Load Balance
Tải xuống phiên bản mới nhất của LiteSpeed Web ADC về thư mục gốc của máy bạn sẽ sử dụng để chạy nó và giải nén tệp đã tải xuống
cd /root wget https://www.litespeedtech.com/packages/lslb/lslb-2.1-x86_64-linux.tar.gz tar -zxvf lslb-2.1-x86_64-linux.tar.gz
Install
Giải nén
tar xvfz lslb-xxxx.tar.gz or gunzip -c lslb-xxxx.tar.gz | tar xvf –
Cài đặt giấy phép bản quyền
Giấy phép dùng thử
- Giấy phép dùng thử bạn có thể đăng ký tại link bên dưới để trải nghiệm trong 15 ngày.
- Sau khi đăng ký thành công, giấy phép được đính kèm trong email của bạn, giấy phép có định dạng là trial.key và bạn cần upload file này lên thư mục cài đặt
Giấy phép chính thức
- Bạn có thể đăng ký tại cửa hàng của LiteSpeed
- Sau khi mua thành công bạn sẽ có một mã Serial đính kèm trong email và đây là giấy phép của bạn.
- Bạn lưu file seriel này thành “serial.no” ở trong thư mục cài đặt (install.sh)
Chuyển đến thưc mục cài đặt
Bạn thực hiện vào thư mục cài đặt và tiến hành cài đặt
/root/lslb-*
./install.sh
.................................. make it enforceable, unless to do so would frustrate the intent of the parties, in which case the EULA will immediately terminate. 7. GOVERNING LAW. This EULA shall be governed and be construed by the laws of state of New Jersey and controlling U.S. federal law. 8. EXPORT RESTRICTIONS The SOFTWARE PRODUCT may be subject to U.S. export laws or regulations and/or export or import regulations in other countries. Each party shall comply fully with all such laws and regulations to the extent applicable and further acknowledges its responsibility to obtain such licenses to export or import as may be required. 9. U.S. GOVERNMENT. If any or all of the SOFTWARE PRODUCT are being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in SOFTWARE PRODUCT and accompanying documentation shall be only as set forth in this EULA. Copyright (c) 2002-2006 Lite Speed Technologies Inc. All rights reserved. IMPORTANT: In order to continue installation you must agree with above license terms by typing "Yes" with capital "Y"! Do you agree with above license? Sorry, wrong answer! Type 'Yes' with capital 'Y', try again! Do you agree with above license? Yes Please specify the destination directory. You must have permissions to create and manage the directory. It is recommended to install the load balancer at /opt/lslb, /usr/local/lslb or in your home directory like '~/lslb'. ATTENTION: The user 'nobody' must be able to access the destination directory. Destination [/usr/local/lslb]: // Enter [OK] Your trial license key will expire in 14 days! Please specify the user name of the administrator. This is the user name required to log into the web administration console. User name [admin]: // Enter Please specify the administrator's password. This is the password required to log into the web administration console. Password: // Nhập Password vào Retype password: // Nhập lại Password As you are the root user, you must choose the user and group whom the load balancer will be running as. For security reason, you should choose a non-system user who does not have login shell and home directory such as 'nobody'. User [nobody]: // Enter Please choose the group that the load balancer running as. User 'nobody' is the member of following group(s): nobody Group [nobody]: // Enter Please specify the port for normal Load Balancer service. Port 80 is the standard HTTP port, only 'root' user is allowed to use port 80, if you have another server running on port 80, you need to specify another port or stop the other server before starting LiteSpeed Load Balancer. /// Tại đây bạn nhập Port vào, vì Port 8090 và 7080 thuộc Port của lscpd và openlitespeed nên bạn cần nhập vào một Port mới HTTP port [8090]: 8080 <== Nhập post vào Please specify the HTTP port for the web administration console, which can be accessed through http://<YOUR_HOST>:<ADMIN_PORT>/ Admin HTTP port [7090]: 7070 <== Nhập post vào LiteSpeed Load Balancer can run in chroot environment. It is impossible for the chrooted process and its children processes to access files outside the new root directory. This will provide an extra layer of protection. This installation script will try to setup the initial chroot environment automatically. Enable chroot [y/N]: y Chroot path must be absolute path and the server root /usr/local/lslb must be included in the chroot directory tree. Chroot directory without trailing '/': / Set chroot directory to '/' will disable chroot. Are you sure? [y/N] y Installing, please wait... groupadd: group 'lsadm' already exists useradd: user 'lsadm' already exists Generating a 2048 bit RSA private key ............................................................+++ ......................................................................................................+++ writing new private key to '/usr/local/lslb/admin/conf/cert/admin.key' ----- Generating key pair for web console login page, please wait ... Generating RSA private key, 512 bit long modulus ....++++++++++++ ..++++++++++++ e is 65537 (0x10001) [OK] The startup script has been successfully installed! Congratulations! The LiteSpeed Load Balancer has been successfully installed. Command line script - "/usr/local/lslb/bin/lslbctrl" can be used to start or stop the server. It is recommended to limit access to the web administration console. Right now the interface can be accessed from anywhere where this machine can be reached over the network. Three options are available: 1. If the interface needs to be accessed only from this machine, just change the listener for the interface to only listen on the loopback interface - localhost(127.0.0.1). 2. If the interface needs to be accessible from limited IP addresses or sub networks, then set up access control rules for the interface accordingly. 3. If the interface has to be accessible via internet, SSL (Secure Sockets Layer) should be used. Please read respective HOW-TOs on SSL configuration. To change configurations of the interface, login and click "Interface Configuration" button on the main page. The administration interface is located at http://localhost:<ADMIN_PORT>/ or http://<ip_or_Hostname_of_this_machine>:<ADMIN_PORT>/ Would you like to have LiteSpeed Load Balancer started automatically when the machine restarts [Y/n]? y [OK] The startup script has been successfully installed! Would you like to start it right now [Y/n]? y [OK] Your trial license key will expire in 14 days! [OK] lslbd: pid=1963. LiteSpeed Load Balancer started successfully! Have fun! [root@labcyberpanel lslb-2.1]# chkconfig lslb on [root@labcyberpanel lslb-2.1]# /usr/local/lslb/bin/lslbd -v // Lệnh check version LiteSpeed/2.1 [root@labcyberpanel ~]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:7080 0.0.0.0:* LISTEN 477/openlitespeed ( tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 464/./bin/lsmcd tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 403/redis-server 12 tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/init tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1963/./lslbd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 477/openlitespeed ( tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 398/sshd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 470/lscpd (lscpd - tcp 0 0 0.0.0.0:7070 0.0.0.0:* LISTEN 1963/./lslbd tcp6 0 0 :::3306 :::* LISTEN 471/mysqld tcp6 0 0 :::22 :::* LISTEN 398/sshd [root@labcyberpanel ~]#
Tiếp theo bạn cần mở port cho 2 dịch vụ này ra. và khởi động dịch vụ với lệnh sau
systemctl start lslb systemctl enable lslb systemctl restart lslb
Tài liệu tham khảo: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:lslb:installation#install