Oracle Cloud
Installing aaPanel on oracle cloud virtual machine
aaPanel is a free and open-source hosting control panel that can be installed on popular Linux distributions like Ubuntu, CentOS, Debian, etc. In this post, I would like to tell you step by step to installation instructions.
You can use any cloud provider for this but I am using the oracle cloud free tier. They have very attractive free cloud resources that you probably don't know. In summary, you can get
- 2 AMD-based VMs with 1 GB ram each
- Arm-based Ampere A1 cores and 24 GB of memory usable as 1 VM or up to 4 VMs with 3,000 OCPU hours and 18,000 GB hours per month
- 2 Block Volumes Storage, 200 GB total
- And many more. Check out their offerings.
Pre-requisites
- An oracle cloud free tier account
- knowledge of some basic Linux commands
Step 1: Creating the VM
In this step, we will create a new AMD-based VM, with CentOS 7 image. You can use other images (Ubuntu, Oracle Linux, CentOS 8, etc.) also. But there is a benefit to using CentOS 7. Later, when you install server software (Nginx, MySQL, etc.), aaPanel will give you 2 options - Fast and Compile. Fast will use pre-compiled binaries that are very fast to install but compile options are very stable because it will download sources, and compile them according to your server environment.
Let's create the VM.
- Log In to your oracle cloud console
- Go to your compute instance page and click create instance button.
- Chose a name of the instance, e.g. aapanel-centos-7
- Edit the Image and Shape > click Change image > Select CentOS, OS version to 7 > click Select image
- Under Add SSH keys, you can generate key pairs (default option) if you haven't already done so. Download the private and public keys and keep them in a separate folder. This will be needed later to log in to the server. If you already have those keys, select upload public key and chose .pub file.
- Finally, click create button. This will start the process and a few minutes later, your instance will be ready to install aaPanel.
Step 2: Installing aaPanel
In this step, we will log in to our newly created VM, update the server software, and install aaPanel. For this, we need some info - server_public_ip, username, and the private key that you used during the creation of the VM. You will find this information on the instance page under the instance access heading.
- Open your terminal or command prompt and navigate to the folder where you kept the SSH keys
- Log in to the VM using the following command. Replace username, server_public_ip, and your_private.key with your own info.
ssh username@server_public_ip -i your_private.key
- Switch to the root user
sudo su -
- Update the server
yum update
- Install the aaPanel by entering the following code
yum install -y wget && wget -O install.sh http://www.aapanel.com/script/install_6.0_en.sh && bash install.sh aapanel
installation prompts
The installation will prompt you for some info and confirmations. Here are my response
- installation directory /www - y
- panel SSL - N (will configure it later)
If everything goes well, the installation process will end in around 8 minutes. After installation is finished, you will find some login credentials and ports information. Save this info, you need it for accessing the panel.
Step 3: Open ports in the firewall
You will find some port information from the previous step. You need to open these ports in the cloud provider's firewall. In our case, default security list. To find this page, search the keyword security list in the search box on the console. Alternatively, you can go there from the instance detail page > virtual cloud network > security lists under resources.
In the security list page, you must Add Ingress Rules for all the ports according to the following table
| source type | source CIDR | IP protocol | Destination port range | Description |
|---|---|---|---|---|
| CIDR | 0.0.0.0/0 | TCP | port | aapanel |
Step 4: Installing software modules
Now log in to the newly installed aapanel using the credentials. Immediately after login, you will be prompted to install the necessary stack (LNMP/LAMP). Choose your stack. For example, I will go for Nginx, MySQL 8, PHP 8, and phpMyAdmin 5. And never forget to check for the FAST option to install from binary.
Step 5: Installing SSL and panel domain
In this step, you need a domain name, to install SSL in your panel. You can use a subdomain also. I prefer to add a subdomain rather than a domain as a panel URL.
- Add an A record to your domain DNS pointing to the server's Public IP. If you are using Cloudflare, be sure to uncheck the proxy.
- In the aaPanel, go to Settings. Enter the selected domain in the domain text field under the security tab. When you click save, the panel will set the domain and you can no longer access it with the IP address. So, you may see a blank page. Replace the IP with your domain in the browser's address bar and log in again.
- Now let's install SSL. Go to the settings, and click the Panel SSL switch under the security section. A dialog window will appear. Select the let's encrypt option, enter your email, check the terms, and submit. After a few moments, your panel will reload with the HTTPS protocol.
In certain cases, you may get some errors. If you can't log in to the panel, try removing the SSL options. Log in to the server via SSH, and enter the following command.
rm -f /www/server/panel/data/ssl.pl && /etc/init.d/bt restart
Other panel ssh commands
Connecting to a Linux Oracle instance
You can connect to a running Linux instance by using a Secure Shell (SSH) connection.
Alternatively, for advanced control of the boot process or OS troubleshooting, you can use the serial console to connect to an instance. For details, see
Connecting to a Linux Instance with SSH
Current versions of Windows, MacOS, and Linux include an OpenSSH client by default. (Windows has included the OpenSSH client since Windows 10 and Windows Server 2019.) When you create an instance, OCI Compute generates OpenSSH keys for you. You download the keys and use them to connect to your instance.
SSH keys required: To connect to your instance with SSH, you must have SSH keys.
- If you lost your SSH keys, terminate the instance and create a new instance using the SSH keys provided or SSH keys you generated. See Managing Key Pairs on Linux Instances.
- If you created an instance without SSH keys, you can use the serial console to connect to your instance and configure SSH. For Oracle Linux, see this example on how to reset the SSH key for the
opcuser using the serial console.
For SSH troubleshooting suggestions, see Troubleshooting the SSH Connection.
For older Windows versions, you can also use the free PuTTY SSH client. See: Connecting to a Linux Instance using PuTTY and Windows.
Before You Begin
You must have the following information to connect to a Linux instance:
-
Public IP address for an instance: Use the public IP address assigned when you created the instance. If you didn't note the address, get the address from the Instance Details page:
- Open the navigation menu and select Compute. Under Compute, select Instances.
- Select your instance.
- Look at the Instance access section. If a public IP address is assigned, the address will be labeled: Public access IP address.
- If no public IP address is assigned, see Assigning an Ephemeral Public IP to an Existing Primary Private IP.
- Username: The username used to connect to the Linux instance. Default users names are assigned based on the Linux distribution used.
- For Oracle Linux or Redhat Enterprise Linux compatible platform images the username is
opc. - For Ubuntu platform images to create the instance, the username is
ubuntu.
- For Oracle Linux or Redhat Enterprise Linux compatible platform images the username is
- SSH private key: The full path to the private key file from the SSH key pair used to create the instance. For more information about key pairs, see Managing Key Pairs on Linux Instances.
Connecting to a Linux Instance from a Windows System Using OpenSSH
Using the OCI generated key pair or your own generated key pair used to create the instance, connect to the Linux instance.
- Set the Permissions for the Private Key File
-
Set the file permissions for the private key file so that only the current user has read-only access. Do the following:
- Locate the SSH key files you created by or created for your instance.
- In Windows Explorer, navigate to the private key file, right-click the file.
- Select Properties.
- On the Security tab, select Advanced.
- On the Permissions tab, for Permission entries, under Principal, ensure that your user account is listed.
- Select Disable Inheritance, and then select Convert inherited permissions into explicit permissions on this object.
- For Permission entries, select each permission entry that isn't your user account and select Remove.
- Ensure that the access permission for your user account is Full control.
- Save your changes.
- Connect to the Instance with PowerShell
-
Next, connect to the instance with PowerShell.
-
Open Windows PowerShell and run the following command:
ssh -i <private_key_file> <username>@<public-ip-address><private_key_file> is the full path and name of the
.keyfile that contains the private key associated with the instance you want to access.<username> is the default username for the instance. For Oracle Linux and Redhat Enterprise Linux compatible images, the default username is
opc. For Ubuntu images, the default username isubuntu.<public-ip-address> is the instance's IP address that you retrieved from the Console.
- If you're connecting to this instance for the first time, you need to accept the fingerprint of the key. To accept the fingerprint, type yes and press Enter.
- You are connected to the default shell for the instance.
- When you have finished your session, type
exitat the shell prompt to end the session.
-
If you are using an older version of the Windows operating system, you can use PuTTY to create keys and connect to a Linux instance. For details on connecting to a Linux instance with PuTTY, see Connecting to a Linux Instance from a Windows System Using PuTTY.