DEV Community

Wincent Balin
Wincent Balin

Posted on • Originally published at ofdigitalwater.postach.io on

2 1

Office in Vagrant VM

I wanted to use office software in a VM, while being able to edit files on the host machine. Usually, people create a VM in VirtualBox and map the host directory into this VM using shared folders. But, because it is a long process, I decided to automate it using Vagrant.

TL;DR

  1. Go to this GitHub repository
  2. Download Vagrantfile and place it into your documents directory
  3. Open your favourite CLI and change into that directory
  4. Run vagrant up to configure the VM and wait for a while
  5. Run vagrant rdp and use vagrant as login and as password
  6. Open LibreOffice and configure your personal data, so the documents with data fields can set them to appropriate values
  7. Edit your documents on the host system!

Design decisions

The Vagrantfile must be placed into directory with documents you want to edit. Of course, I could add the default documents directory on the host OS, but I decided against it: first, it would create additional maintenance burden (especially if the syntax for default OS paths changes), and second, it would not work on systems, where the documents directory was moved to another location. So, for now, the entry for synchronised directory is

config.vm.synced_folder ".", "/home/vagrant/Documents", mount_options: ["dmode=775,fmode=664"]

Enter fullscreen mode Exit fullscreen mode

The VM created by Vagrant is based on Ubuntu Bionic x64. The Vagrantfile installs the packages xubuntu-desktop and libreoffice. Then it also enables Remote Desktop connexions by installing xrdp, by starting it automatically as a service and by enabling port 3389. The forwarding to the port is configured with

config.vm.network "forwarded_port", guest: 3389, host: 33389, protocol: "tcp", auto_correct: true

Enter fullscreen mode Exit fullscreen mode

The automatic start of XFCE session is enabled by adding xfce4-session to the file .xsession. Everything is run as the default Vagrant user vagrant.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more