*Thinking...*

> **Examining User Needs**
> 
> I'm currently focused on the user's explicit request: migrating an Ubuntu Server to an Ubuntu Server Pro setup. My analysis is zeroing in on the crucial elements, like the type of operating system and the eventual outcome desired. This will enable me to craft the proper upgrade steps.
> 
> 
> **Dissecting The Target**
> 
> I've moved on to examining the core of "Ubuntu Pro." I need to fully grasp its core components: it's a paid subscription from Canonical. This knowledge is fundamental for formulating the precise conversion steps. Knowing the subscription model is crucial to ensuring a complete and accurate response.
> 
> 
Upgrading an existing Ubuntu Server to **Ubuntu Pro** is a straightforward process that involves attaching your machine to a Canonical Ubuntu Pro subscription. This does not require reinstalling the operating system; it is an in-place enablement of additional services and repositories (such as Extended Security Maintenance).

Here is the step-by-step guide to upgrading your server.

### Prerequisites

1.  **An Ubuntu One Account:** You need an account to manage your subscriptions.
2.  **An Ubuntu Pro Token:** You can get a free token for personal use (up to 5 machines) or a paid enterprise token from the [Ubuntu Pro Dashboard](https://ubuntu.com/pro).
3.  **Root/Sudo Access:** You must have administrative privileges on the server.

---

### Step 1: Update Your System

Before applying the Pro subscription, ensure your current system is up to date. This ensures the `pro` client software is installed and current.

Open your terminal and run:

```bash
sudo apt update && sudo apt upgrade -y
```

### Step 2: Ensure the `ubuntu-advantage-tools` are Installed

The command-line tool used to manage Ubuntu Pro was formerly known as `ua` (Ubuntu Advantage) but has been renamed to `pro` in newer versions. The package responsible for this is `ubuntu-advantage-tools`.

Verify it is installed and up to date:

```bash
sudo apt install ubuntu-advantage-tools
```

### Step 3: Check Your Current Status

You can check the current subscription status of your server to confirm it is not already attached.

```bash
pro status
```

*Output should indicate that the machine is not attached to a subscription.*

### Step 4: Attach the Server to Ubuntu Pro

This is the primary step. You will need the token from your Ubuntu Pro dashboard.

1.  Log in to [ubuntu.com/pro](https://ubuntu.com/pro).
2.  Copy your token (it looks like a long alphanumeric string, e.g., `C123456789...`).
3.  Run the attach command on your server:

```bash
sudo pro attach <YOUR_TOKEN>
```

**Example:**
```bash
sudo pro attach C1zR4r7...
```

### Step 5: Verify the Upgrade

Once the command completes, it will display a summary of the services that have been enabled (such as ESM-Infra, ESM-Apps, or Livepatch).

Run the status command again to see the detailed report:

```bash
pro status
```

You should see a table listing services like `esm-infra`, `esm-apps`, and `livepatch` with a status of `enabled`.

### Step 6: Enable Specific Services (Optional)

By default, `pro attach` usually enables the most common services relevant to your version. However, you may want to manually enable specific features like **Kernel Livepatch** (which allows kernel updates without rebooting) or **ESM-Apps** (security patching for community applications).

**To enable Livepatch:**
```bash
sudo pro enable livepatch
```

**To enable Extended Security Maintenance for Applications:**
```bash
sudo pro enable esm-apps
```

### Step 7: Update Sources for Pro Security Updates

After attaching and enabling services, run an update to ensure your package manager sees the new security updates available through the Pro repositories.

```bash
sudo apt update
sudo apt upgrade -y
```

If you enabled `esm-apps` or `esm-infra`, you might see a significant number of updates become available immediately, as this unlocks security patches for older packages that were previously unsupported.

---

### Troubleshooting

**If the `pro` command is not found:**
If you are on a very old version of Ubuntu (older than 16.04), you may need to use the legacy `ua` command, though upgrading your OS version is highly recommended. On 16.04+, if `pro` is missing, ensure `ubuntu-advantage-tools` is installed as shown in Step 2.

**Proxy Configuration:**
If your server is behind a corporate firewall or proxy, the attach command might fail. You can configure the proxy specifically for the Pro client:

```bash
sudo pro config set http_proxy=http://proxy.example.com:8080
sudo pro config set https_proxy=https://proxy.example.com:8080
```

**Detaching the Subscription:**
If you need to remove the Pro license from this server (for example, to move the token to a different machine), run:

```bash
sudo pro detach
```