I've deployed to VM's running Debian on GCE and have cron scripts that use gcloud commands.
I noticed that gcloud components update retuns this error
ERROR: (gcloud.components.update) The component manager is disabled for this installation
My mac works fine to update gcloud and add new components.
The built in gcloud tools that were in the VM image won't update. I have not found out how to enable the component manager.
UPDATED
Now you can use sudo apt-get install google-cloud-sdk command to install or update Google Cloud SDK.
You may need to add Cloud SDK repository in your Linux machine. This is the instructions.
Note: The following workaround should not be used anymore.
The component manager is enabled on latest images and gcloud components update command should be working now.
In case you're still experiencing this issue, use the following command to enable updater:
sudo sed -i -e 's/true/false/' /usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/config.json
You cannot update components using the built in SDK tools on a compute engine instance. However you can download another local copy of the SDK from https://cloud.google.com/sdk/ (curl https://sdk.cloud.google.com | bash) and update your path accordingly to use the new SDK install, and you will have the component manager enabled.
Came here while trying to gcloud components install [x] on a Docker container from google/cloud-sdk and getting the same error (I am probably not the only one on this situation).
Unfortunately, apt-get install google-cloud-sdk (as suggested on the most upvoted answer) didn't help.
But the ugly sed on config file did the trick. Dirty but efficient fix (for the moment).
RUN sed -i -e 's/"disable_updater": true,/"disable_updater": false,/' /usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/config.json
Building off of Vilas's explanation above: you can't run the updater for the built in gcloud image. However you can install a copy of gcloud outside of the package manager and run the updater on that gcloud install.
You can now run sudo apt-get install google-cloud-sdk on the Google Compute Engine default images to update the Cloud SDK.
Related
Background Information
I'm trying to ensure that no matter how many times / when I run my gilab-ci.yml file, it will consistently download and install the EXACT same Azure Function deployment environment each time. I don't want to run the script today and have Azure CLI version 2.25 and then tomorrow when we trigger the pipeline, it will install / use version 2.26.
I recently came across an article that shows how to deploy an Azure Function. It's found here: https://dev.to/alandecastros/gitlab-ci-script-to-deploy-a-azure-function-3gc4
For ease of readability, I've copied and pasted the gitlab-ci.yml code here:
stages:
- deploy
deploy:
stage: deploy
image: mcr.microsoft.com/dotnet/core/sdk:3.1
script:
- curl -sL https://aka.ms/InstallAzureCLIDeb | bash
- apt-get install curl && curl -sL https://deb.nodesource.com/setup_12.x | bash -
- apt-get install nodejs
- npm install -g azure-functions-core-tools#3 --unsafe-perm true
- az login --service-principal -u $APPLICATION_ID -p $APPLICATION_SECRET --tenant $TENANT_ID
- func azure functionapp publish $FUNCTION_APP --csharp
only:
- master
QUESTIONS
From what I can tell, it feels like the first command under the scripts section will install the latest version of the Azure CLI. Is this correct? I reviewed the https://azurecliprod.blob.core.windows.net/$root/deb_install.sh file and it seems it's adding the necessary repositories to the Debian image and then runs
apt-get install -y azure-cli
In the case of nodejs, it seems it will always install major version 12... but the sub version can change. Is this correct?
How can I change this logic to control version numbers? One idea is to create my own docker image using this logic once, and then just keep reusing the custom image. I've tested it and its working.
But is there a way to install a very specific version of node? I tried to test like this:
# apt-get install curl && curl -sL https://deb.nodesource.com/setup_12.x | bash -
I can see it's installed 12.22.1
Unpacking nodejs (12.22.1-1nodesource1) ...
Setting up nodejs (12.22.1-1nodesource1) ...
I tried to follow up and do something like this:
# apt-get install nodejs12.22.1
and also
#apt-get install node_12.22.1
But in both cases I'm getting errors that it can't find these packages.
Thanks for reading / for the help.
Both the Azure CLI and Node.js offer a bash script for installation of the tools - with the drawback of always getting the latest release (then again for the majority of users this is probably a good thing). These scripts - as you figured out - do additional things like managing the repositories and trust.
Azure CLI
Microsoft offers a documentation on how to pin to a version: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#install-specific-version
In essence, you have to manually trust the signing key and add the repository as would be done by the script. Afterwards you can use the regular apt-get <package>=<version> syntax to specify a version.
Node.js
In case of Node, they are at least offering different scripts for each major release. But otherwise, it seems to be a bit more involved as is evident from https://github.com/nodesource/distributions/issues/33. I haven't tried the proposed workarounds from there as I personally am not interested in pinning Node.js to a minor release.
Running a python Azure function on Linux consumption plan. I have been able to successfully deploy the function to Azure using VS Code. All the packacges in requirements.txt are getting installed without a problem. But now i need to install tesseract which only can be installed through apt-get
You can use tasks.json in the Azure function project which allows you to configure tasks which would run. There is even a breakdown on an operating system level e.g. windows should run specific commands and Linux should run differently.
I have an .net core application hosted on an Azure App service running linux. After running into issues with libgdiplus not being found, I ran across the solution to use apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev && dotnet YourWebSite.dll as the startup command in Azure. Unfortunately whenever I push code, the command is overwritten with the default dotnet YourWebSite.dll. I've looked through the publish settings in Visual Studio, but I can't find anything that seems to relate to the startup command.
I do not think you can change the start up command from Visual Studio. But you can change the start up command in Azure portal instead.
Go to your app service, go to Configurations
Here you can change the start up command.
We need to build an Angular 6 front end project on IBM Cloud using the DevOps pipeline, but the project requires at least Node v8, while IBM Cloud DevOps pipeline only support v6.7. How can we build our project? Is it possible to upgrade or customize a Node version in DevOps pipeline environment?
It is true that IBM's DevOps Toolchains currently export up to node 6.7.0 as detailed here https://console.bluemix.net/docs/services/ContinuousDelivery/pipeline_deploy_var.html#deliverypipeline_environment.
But you are free to install any version of node. To do so, add the following to your build job and remove any existing export to node supplied by the pipeline.
#!/bin/bash
npm config delete prefix
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 8.9.0
node --version
# build instructions follow
This approach uses Node Version Manager.
Another different solutions is using a custom Docker image with the Node version required by your service.
So, to configure your Pipeline Step, you need to select as Compilator Type a "Custom Docker image" and then, in the input field for the container name, select one for your Node version, for example "node:10.15.2"
I'm beginner of Google Cloud Platform and Linux.
I set linux(ubuntu) instance on Google Cloud Platform and tried to install packages by using apt-get command, and I got direction below
username#name_of_instance-145302:~$ sudo apt-get install ssh
********************************************************************************
You are running apt-get tool inside of Cloud Shell. Note that your Cloud Shell
machine is ephemeral and will be reset once you are not using it interactively
for about half an hour. No system-wide change will persist beyond that.
Note that your home directory does persist across VM instantiations, so consider
installing your tools into your home directory whenever possible.
To suppress this warning, create an empty ~/.cloudshell/no-apt-get-warning file.
The command will automatically proceed in 5 seconds or on any key.
Visit https://cloud.google.com/shell/help for more information.
********************************************************************************
Maybe this warn shows that any files under the instance except $HOME directory will be cleared.
I want to save files under the $HOME directory, but downloaded packages are under the /etc/package_name - not under the $HOME directory.
So any applications downloaded from apt-get is deleted in 30 min after last operation.
How can I keep packages on $HOME directory?
You tried to run apt-get from cloud shell not from your instance. you should ssh to your instance first. (one option is using "gcloud compute ssh "your instance name"), then you will be able to run apt-get.