I wanted to know if there is a way to do a silent install of the Qt run installer on Ubuntu Server?
I mean by-pass the options of the installer and do a default install?
Note: the script which is described below has been deprecated in the meantime. Rationale and some alternative scripts are listed on the project's home page. Perhaps some of its forks do work, however.
Couple of months ago, I have crafted a configurable helper script for Qt installation automation. Although it is not a truly headless installer, as it simply iterates through install wizard screens, it can be used in continuous integration servers, and in fact it is tested this way.
Notes & features:
Home page: https://github.com/skalee/non-interactive-qt-installer
The script above is old. This should work (and I added retry for download errors)
function Controller() {
installer.autoRejectMessageBoxes();
installer.setMessageBoxAutomaticAnswer("installationError", QMessageBox.Retry);
installer.setMessageBoxAutomaticAnswer("installationErrorWithRetry", QMessageBox.Retry);
installer.setMessageBoxAutomaticAnswer("DownloadError", QMessageBox.Retry);
installer.setMessageBoxAutomaticAnswer("archiveDownloadError", QMessageBox.Retry);
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
})
}
Controller.prototype.WelcomePageCallback = function() {
// click delay here because the next button is initially disabled for ~1 second
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function()
{
//dev is the user in our docker image
gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.value("HomeDir") + "/Qt");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.PerformInstallationPageCallback = function() {
gui.clickButton(buttons.CommitButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
function list_packages() {
var components = installer.components();
console.log("Available components: " + components.length);
var packages = ["Packages: "];
for (var i = 0 ; i < components.length ;i++) {
packages.push(components[i].name);
}
console.log(packages.join(" "));
}
list_packages();
var widget = gui.currentPageWidget();
console.log(widget);
widget.deselectAll();
widget.selectComponent("qt.qt5.5130");
widget.selectComponent("qt.qt5.5130.gcc_64");
// widget.deselectComponent("");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function()
{
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
checkBoxForm.launchQtCreatorCheckBox.checked = false;
}
gui.clickButton(buttons.FinishButton);
}
run with verbose so you don't have to wait too much time without output
qt.run -platform minimal --verbose --script ./qt-installer-noninteractive.qs
I had the same problem and came up with a simple python script that basically does the same what the official Qt installer does. You can find it here.
And that's how to use it:
sudo apt install python3-requests p7zip-full wget
wget https://git.kaidan.im/lnj/qli-installer/raw/master/qli-installer.py
chmod +x qli-installer.py
./qli-installer.py 5.11.3 linux desktop
Then the Qt installation can be found at ./5.11.3/gcc_64/
in this case. With other systems/targets (i.e. mac ios
or linux android android_armv7
) this will differ of course.
https://lnj.gitlab.io/post/qli-installer/
Version 4.0
of the Qt online installer has first-class support for headless installation.
See this answer below for more info.
Original answer:
As of October 8, 2019, an extra screen has been added on Windows which will cause the installation to hang. You can click through it with the following addition to your .qs
file:
Controller.prototype.DynamicTelemetryPluginFormCallback = function() {
var widget = gui.currentPageWidget();
widget.TelemetryPluginForm.statisticGroupBox.disableStatisticRadioButton.checked = true;
gui.clickButton(buttons.NextButton);
}
Another recent change is to package categories. LTS is now the only one selected by default, meaning that you cannot install the latest Qt version without first selecting "Latest releases" in the package categories.
Here's how to do that:
Controller.prototype.ComponentSelectionPageCallback = function() {
var page = gui.pageWidgetByObjectName("ComponentSelectionPage");
var archiveCheckBox = gui.findChild(page, "Archive");
var latestCheckBox = gui.findChild(page, "Latest releases");
var fetchButton = gui.findChild(page, "FetchCategoryButton");
archiveCheckBox.click();
latestCheckBox.click();
fetchButton.click();
// ...
}
See here for a more complete example for Windows.
The Qt installer v4.0
has been released, and it can run headless now:
qt-unified-windows.exe install --root C:\Qt\InstallFolder
You can use --help
for a list of available commands:
qt-unified-windows.exe --help
The command-line installer requires user interaction, but this can be bypassed with flags. See this wiki page for a full list.
You can download the beta installer here.
Credentials are now mandatory since 3.2.1, as explained a bit above. A qtaccount.ini file is created in ~/.local/share/qt
. If you can't save & reuse this file, because your script needs to work for multiple users for example, you can use this new CredentialsPageCallback:
Controller.prototype.CredentialsPageCallback = function() {
var page = gui.pageWidgetByObjectName("CredentialsPage");
page.loginWidget.EmailLineEdit.setText("MYEMAIL");
page.loginWidget.PasswordLineEdit.setText("MYPASSWORD");
gui.clickButton(buttons.NextButton);
}
As always, please be careful when moving passwords around, especially in clear text.