Install Publish Over SSH Plugin
So go to Manage Jenkins —> Manage Plugins
Add remote server to Jenkins Config
After installing this plugin, we will add our remote server in jenkins config, for that you have to go to :
Manage Jenkins –> System configuration –> Publish over SSH Server
Here we will add our remote server config , for that you will need a username, password, host IP, and you can choose the remote directory where Jenkins will do the deployment .
Setup Deploy in the pipeline
After saving the config of the server, we will go to our project freestyle config and we will add a step after the build, here we will choose : Send build Artifact over SSH
Here we will choose the server , the file to send , and the command to execute in the remote server.