[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Time:2023-10-19

preamble

  This tutorial will be available atUbuntu Installation in a server environmentcode-server and useAndroid Android Tablet RemoteUbuntu service for remote programming development to write code. Also paired withcpolar Intranet penetration tool for offsite remote access to Ubuntu’s code-server in a public network environment.

1.ubuntu local install code-server

  Prepare a virtual machine, Ubuntu or centos can be, here toVMwhere ubuntu system as an example

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

  To download the code server service, please visit the following web browser.https://github.com/coder/code-serverCopy the download link

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Open ubuntu command line download

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

You will be asked to enter your ubuntu login password, enter it and wait for the installation to complete.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

The following message indicates successful installation

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Next, enter the following command to set the login password for code-server

export PASSWORD=”000000”

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

View IP address for LAN access

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

code-server service defaults to port 8080, in order to prevent port 8080 conflict, we modify the code-server port number, enter the following command, edit the configuration file

sudo vim ~/.config/code-server/config.yaml

127.0.0.1 to 0.0.0.0, port 8080 changed to their favorite port, this example is changed to 8077, modify the completion of the save

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

After setting the password, start the code-server service and enter the following command.

code-server 

Address and port number information appears to indicate successful startup

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Then open the browser through the LAN ip address to visit http 8077/, appear welcone code-server indicates success, enter the password we set up, login can be.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

2. Installation of cpolar Intranet Penetration

Then use cpolar to penetrate the local code-server service, so that android devices can be accessed remotely, write code anytime, anywhere. cpolar supports http/https/tcp protocols, unlimited traffic, easy to operate, no need for a public IP, no router.

cpolar official website:https://www.cpolar.com/

Installation of cpolar intranet penetration (supports one-click auto-installation script)

  • cpolar installation (for domestic use)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • or cpolar short link installation method: (for foreign use)
curl -sL https://git.io/cpolar | sudo bash
  • View version number
cpolar version
  • token authentication

Log in to the backend of the cpolar website, click on Authentication on the left side, check your authentication token, and then paste the token into the command line

cpolar authtoken xxxxxxx

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

  • Adding services to the system
sudo systemctl enable cpolar
  • Start the cpolar service
sudo systemctl start cpolar
  • Check Service Status
sudo systemctl status cpolar

  The normal display isactiveThen it indicates that the service is in the normal online startup state.

3. Create a tunnel to map the local port

After installing cpolar Intranet Penetration locally on your ubuntu system, access port 9200 locally on your ubuntu browser, or access port 9200 on your external browser using your LAN ip address, and open the cpolar web ui interface.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

After logging in, click on Tunnel Management – Create Tunnel in the left dashboard, and since we configured port 8077 above in code-server, we are going to come and create an http tunnel pointing to port 8077:

  • Tunnel name: customizable, be careful not to duplicate the existing tunnel name.
  • Protocol: http
  • Local address: 8077
  • Port type: random domain name
  • Region: China vip

  strike (on the keyboard)establish

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Created successfully we open the list of online tunnels, you can see just created a successful tunnel, there have been generated the corresponding public address, the public address copied down, the next test remote development to write code.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

4. Android tablet test access

Open your Android browser, any browser, enter the above link to visit successfully!

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

5. Fixed domain name public address

In cpolar intranet penetration, because we just created the tunnel selection is free random temporary tunnel, it generates the public address will change within 24 hours, in order to more stable access, we next configure it as a fixed address.

You need to upgrade to the basic package or above to support the configuration of fixed second-level domain name.

  log incpolar official website backstage, click on the left dashboard of thereserveFindReservation of second-level subdomains, reserving a second-level subdomain for the http tunnel.

  • Region: Select server region
  • Name: fill in the second-level subdomain you want to keep (customizable)
  • Description: i.e. notes, can be customized to fill in

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

  This example reserves a namecodeservertestof the second-level subdomain. Once the subdomain was successfully reserved, we copied the subdomain and next we need to configure it to bind to the tunnel.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

  Log in to the cpolar web ui management interface and click on the left dashboard of theTunnel Management——Tunnel Listto find the tunnel that needs to be configured for the second-level subdomain (in this case, the code-server tunnel), click on the right side of thecompiler

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Modify the tunnel information to configure the second-level subdomain into the tunnel:

  • Domain name type: change to selectsecond-level subdomain
  • Sub Domain: Fill in the second-level sub-domain we just reserved (in this case, thecodeservertest

  When the modification is complete, clickupdate

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

  After the tunnel has been successfully updated, click on the left dashboard’sstate of affairs——Online Tunnel ListYou can see the tunnel’s public address, which has been updated to a second-level subdomain, copy the public address down.

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

Open your Android browser and enter the fixed http link above to access it successfully

[Android Tablet Programming] Remote Ubuntu server code-server programming to write code

5. Conclusion

  Use on Androidvscode The main thing is to connect a remotecode-server Services.code-server service is installed in the system, the call is what the system environment, such as here to use theubuntu carry out the installationcode-server That’s what the use ofubuntu environment, such as go, python, java development, you need to install the relevant environment in Ubuntu, the creation of the folder and project is also in theUbuntu Inside. This way you can actually access thevscode It can be used anytime, anywhere and is not affected by the device.

Recommended Today

uniapp and applet set tabBar and show and hide tabBar

(1) Set the tabBar: uni.setTabberItem({}); wx.setTabberItem({}); indexnumberisWhich item of the tabBar, counting from the left, is indexed from 0.textstringnoButton text on tabiconPathstringnoImage PathselectedIconPathstringnoImage path when selectedpagePathstringnoPage absolute pathvisiblebooleannotab Whether to display uni.setTabBarItem({ index: 0, text: ‘text’, iconPath: ‘/path/to/iconPath’, selectedIconPath: ‘/path/to/selectedIconPath’, pagePath: ‘pages/home/home’ }) wx.setTabBarItem({ index: 0, text: ‘text’, iconPath: ‘/path/to/iconPath’, selectedIconPath: ‘/path/to/selectedIconPath’, pagePath: ‘pages/home/home’ }) […]