As well as being able to copy files locally, we can
copy files to remote systems.
We need a user account on our Ubuntu system to use, so we create the
user account and set the password. Then back on our Alma Linux
system, we can use scp, secure copy, to copy file1 through to the
user account on the remote system.
We can also go through and create ourselves a directory where we can move a
whole directory, but we're unlikely to use scp for that. To populate that
directory on the Alma Linux system, we can take a look at the find command. We
can look for all HTML files and copy those into our docs directory. With that
done, we can then use the rsync command.
The rsync command can be used locally, but we can also use it with an external
program. Here, the option, ‑E, is saying the external program that we're using
is then SSH. We're copying the complete docs directory and its content through
to the user1 account on our remote system.
So this gets us used to copying files. Now, as well as copying files
in that manner, we might be working in a DevOps environment and using
a version control system such as Git.
We'll going to take a quick look at Git now, but we'll see it more when we
take a look at scripting. We can go through and make sure that we're logged
on as user1. In the user1's home directory,
creating a project1 directory and moving into that directory. We can make
sure, then that we create a new and empty Git repository in the project1
subdirectory. And then from the Alma Linux system,
we can go through and clone that empty project. We'll
populate it on the Alma system. We can move into the
project1 directory that we've cloned,
create ourselves a script, and add in the execute permissions that we need.
We can then go through and add in the complete directory,
set up a username and a name.
We need this to be able to say who made the edits, and then commit those edits.
Once we've done that, we can then go through and push our working
copy back to the master copy on our Git server.
This, then makes it easy for anybody else to get to
the code or collaborate in the code.
We can even move on to our openSUSE system,
making sure that we've got git‑core installed.
We already installed it on our Alma Linux system, and it's installed by
default on our Vagrant box for Ubuntu. And then we can go through and
clone the repository, and our script should then come down. Now, of
course, then we need to go through and look at it. In our first
demonstration, we'll be taking a look at how we can remotely copy files,
and then secondly, we'll be taking a look at setting up this very basic Git repo.